Drawing Definition FIle

A drawing definition file consists of a sequence of variable definition lines followed by lines with named command strings. It is possible to mix the order of variable definitions and command strings but it helps with readability to put all variable definitions first.

The exact syntax of these lines is defined below but common to both the variable definitions and command strings is the fact that they must both end in a semicolon. Anything after the semicolon is ignored and can be used as comments.

A line beginning with a semicolon is ignored and can be used as a comment line. Any line that does not contain a semicolon is also ignored. If a drawing fails to execute properly check that all variable definitions and command strings end in a semicolon otherwise they are ignored.

Note that the names of all variables, functions and commands are case sensitive. In other words, the variable x is different than the variable X.

Variable Definition Lines

A variable definition line takes the form of a variable name followed by an equal sign followed by a mathematical formula ending with a semicolon. There can be only one variable definition per line.

The variable name can be any alphanumeric string that does not contain whitespace. The mathematical formula can be any standard mathematical expression involving the operators +, -, *, /, ^(exponentiation), (, ), and the following functions

A mathematical expression can contain previously defined variables. The variable pi=3.14159265359 is always predefined. Arguments and return values for all trigonometric functions are in terms of radians where pi radians is equal to 180 degrees.

Named Command Strings

A named command string takes the form of a name followed by a colon followed by a string of commands ending in a semicolon. The name can be any alphanumeric string that does not contain whitespace. Commands may or may not be separated by white space. To enhance readability at least one blank space should be placed between commands but it is not strictly necessary. Names are used in the substitution command defined below. It can also be used to specify the starting string of drawing commands by passing it to the nell program as a parameter.

The following is a list of the possible commands that may appear in a command string. Examples of how to use these commands are given in the following chapters.