home *** CD-ROM | disk | FTP | other *** search
-
- COMMANDS
-
- There are two types of commands: system commands, and "desk calculator"
- commands. There are four system commands: load (to load a Proxy file),
- transcript (to store in a file a transcript of all subsequent keystrokes),
- help (to obtain the syntax and functionality of different commands,
- statements and composite data structures), and exit (to return to the
- DOS prompt). Desk calculator commands are the expressions, assignments,
- and definitions that can be typed at the Proxy prompt for immediate
- evaluation and execution.
-
- The simplest desk calculator command is an expression to be evaluated, i.e.
- 2+2. Note that every command must be terminated with a semi-colon. There
- are four types of expressions: integer, real, string, and boolean. Real
- literals are written in decimal form, i.e., 3.14159; there must be at least
- one digit before the decimal point. Boolean literals are written true, false,
- and strings are written with double quotes, i.e. "This is a string".
-
- Slightly more complicated expressions involve identifiers (variables).
- All identifiers must start with a letter. The rest of the identifier may
- consist of letters, underscores, or digits. Identifiers are not case
- sensitive, i.e. aBcD is considered to be the same identifier as abcd.
-
- The standard arithmetic, relational and Boolean operators are supported
- with their relative precedence given by the following table:
-
- ! - (unary minus) highest
- * / % && |
- + - || v
- == != < > <= >= lowest
-
- where ! represents logical negation, % is the modulo operator, && is logical
- conjunction, || is logical disjunction, == represents equal, and !=
- represents not equal.
-
- A list of the commands and simple examples of their use is given below.
-
- Type of Command Example
-
- load command load "topsort.prx";
- transcript command transcript "session.txt";
- help command help;
- exit command exit;
- expression x + 3 ;
- function definition fun(y) {return y + 1;};
- assignment y = 17 ;
- struct declaration struct empl {age, citizen;};
- struct instantiation p = new empl(25, true);
- struct component update p.age = 26;
- map update table[3] = 4;
- class definition class stack(;rep) {
- stack() {rep = [];}
- push(x) {rep = [x] conc rep;}
- top() {return hd rep;}
- pop() {rep = tl rep;}
- empty() {return rep == [];}};
- class instantiation s = new stack();
-