next up previous contents index
Next: The !tk Command: Execute Up: Scripts Previous: The !exec Command: Execute   Contents   Index


The !lisp Command: Execute Lisp Script

Syntax: !lisp filename [args ...]
PRELIMINARY
This is an interface to the Lisp/Skill parser that is under development. The filename is searched for in the script path and the current directory, and is expected to contain a script in Lisp format. The file will be parsed and the code executed.

Any text following the filename will be parsed as Lisp and included in the argument list. The argument list can be accessed from within the script through the global variables argc and argv.

argc
An integer giving the length of argv.
argv
A list. The first element is the file name, followed by the arguments if any.

The language supported here is similar to Lisp, and to the Cadence Skill language. The intention is not to replicate all features of these languages, but to provide a minimal subset of features for compatibility. The language will be referred to as ``Lisp'', but it should not be confused with the full-blown programming language.

One of the advantages of Lisp is the ease with which the syntax can be parsed. The basic data object is a ``node'', which has the form

[name]( data ... )
If a node has a name, there is no space between the name and the opening parenthesis. A named node is roughly equivalent to a function call. The data can be nodes, strings, or numerical expressions. The items are separated by white space. The data can use arbitrarily many lines in the input file.

Lisp variables are defined when assigned to, and have global scope unless declared in a let node, in which case their scope is within the let node, i.e., local.

A Lisp file consists of one or more named nodes. When the file is accessed with the !lisp command, each of the nodes is evaluated. The nodes must have names that are known to Xic. These are:

main
The content of this node is evaluated. This is a special name for the "main" function of a script.
Built-in function name
These are the basic Lisp functions and operator-equivalents.
Xic function name
All of the Xic script functions will be recognized, however in Lisp the first character of these functions is always lower case. i.e., the Edit script function would be accessed as edit( ) in Lisp. Also, only Xic functions that take string or numeric arguments will work at present.
User-defined procedures
These are Lisp functions defined by the user with the Lisp procedure( ) function.
Cadence compatibility name
There is a growing number of node names that are used to interpret Cadence startup and control files (see 2.7).

A node name that can't be resolved will generate an error.

The following built-in node names are recognized.

Operator Equivalents
expt expt(x y) $ \Longleftrightarrow$ x^y
times times(x y) $ \Longleftrightarrow$ x*y
quotient quotient(x y) $ \Longleftrightarrow$ x/y
plus plus(x y) $ \Longleftrightarrow$ x + y
difference difference(x y) $ \Longleftrightarrow$ x - y
lessp lessp(x y) $ \Longleftrightarrow$ x < y
leqp leqp(x y) $ \Longleftrightarrow$ x < = y
greaterp greaterp(x y) $ \Longleftrightarrow$ x > y
geqp geqp(x y) $ \Longleftrightarrow$ x > = y
equal equal(x y) $ \Longleftrightarrow$ x = = y
nequal nequal(x y) $ \Longleftrightarrow$ x ! = y
and and(x y) $ \Longleftrightarrow$ x && y
or or(x y) $ \Longleftrightarrow$ x || y
colon colon(x y) $ \Longleftrightarrow{^\prime}$ (xy) $ \Longleftrightarrow$ x : y
setq setq(x y) $ \longleftrightarrow$ x = y
Lists
' returns list of arguments
list returns substituted list of arguments
cons add element to front of list
append append lists
car return leading element of list
cdr return list starting at second element
nth return N'th element of list
member return true if element in list
length return length of list
xCoord return first element of list
yCoord return second element of list
Miscellaneous
main main function
procedure define a procedure
argc command line argument count
argv command line argument list
let variable scope container


next up previous contents index
Next: The !tk Command: Execute Up: Scripts Previous: The !exec Command: Execute   Contents   Index
Stephen R. Whiteley 2006-10-23