next up previous contents index
Next: Errors Up: Using NESL Previous: How NESL evaluates expressions

Top-level expressions and commands

  

At the NESL prompt you can type a NESL top-level expression, as defined by the language, or a top-level command, which is used to control or examine various aspects of the environment. The top-level commands are summarized in Figure 1 and most are described in Section 3.

  
Figure 1: Top-level commands (screendump obtained by typing ?).

A top-level expression is one of

tabular99

where exp is any expression and pattern can either be a single variable name or a parenthesized pattern of variable names (the square brackets indicate that the typedef in a function definition is optional). A full syntax for each of these is given in Appendix A of the NESL language definition [1]. Some examples of top-level expressions include:

function double(a) = 2*a;
function add3(a,b,c) = a + b + c;
datatype complex(float,float);
foo = double(3) + add3(1,2,3);
foo;
Expressions that are not assigned to a user defined variable are assigned to the variable it.

If you hit Return before an expression is completed, either for readability or by mistake, a ``>''  is printed at the beginning of each new line until the expression is completed. For example:

<Nesl> 2
> +
> 3;

Compiling..Writing..Loading..Running..
Exiting..Reading..
it = 5 : int
If you get lost, instead of hitting Ctrl-C  try typing a few semicolons to end the expression.

For an example NESL session showing many features of the language, see Appendix A.



Guy Blelloch
Tue Nov 28 18:37:09 EST 1995