Chapter 11: INTERPRETERS

plug

11-1: Introduction to Interpreters

plug


Electric has built in interpretive languages that provide great power in design. The TCL interpreter is a graphical user-interface language. The Lisp interpreter implements a Scheme Lisp dialect. The Java interpreter connects with the Java Virtual Machine.

Note, however, that because of copyright restrictions, these interpreters are not part of the standard GNU distribution and must be obtained separately. The TCL and Lisp source code are available from Static Free Software. The Java interpreter is available from Sun (see the installation instructions for UNIX, Section 1-3, and Windows, Section 1-5).

The Interpretive Language command of the Windows menu shows the language choices available: TCL..., LISP... and/or Java... Once these commands are issued, you are in direct communication with the interpreter and may type arbitrary expressions in the messages window. When done with an interpretive session, type Ctrl-D to return to Electric (hold the control key and type "D"). On Windows systems, type ESC.

The Java interpreter has two options, invoked with the Java Options... subcommand of the Interpretive Language command of the Windows menu. You can choose to disable the Java compiler, forcing interpretation at each step (useful when debugging). You can also choose to disable Java evaluation completely, causing all expressions to appear in their "source" form (this is useful when documenting code: the expressions will appear in the place of their evaluated values).
Figure 11.6

Besides basic expressions in the language, it is possible to examine and modify the Electric database. Special language extensions exist for doing this. For more information, see the following sections on Lisp (Section 11-2), TCL (Section 11-3), and Java (Section 11-4).

Another way to make use of the interpretive languages is to create attributes on Electric objects that are described with code. Using the Attributes... command of the Info menu, and clicking on the "More" button, you can create new attributes that are actually code. Change the "CODE" popup entry to "TCL", "LISP", or "JAVA" and type the code in the "Value" field. The use of this dialog is beyond the scope of this manual, because it is essentially a debugging tool for examining the internal data structures of Electric.


Prev Previous     Contents Table of Contents     Next Next