Programs in String Notation
The following briefly describes the syntax WIDE employs for expressing WHILE programs in String notation (*.while files).

Programs
A program has the structure: read X C write Y Note: each part on a separate line, no punctuation is used to separate them.
Commands
Basic commands:
assignment | X := E
sequencing | C; D
conditional | if E then C else D
loop | while E do C
Remark: command nesting is indicated by indentation. The string-notation compiler insists that in a command sequence C1; C2; ...; Cn each command must stand on a separate line, with the semicolon at its end, and all at the same indentation. Extra (sugar) commands:
| The Citation Command
|  | Syntax: var := <program.wcl> expression Meaning: Invoke program.wcl on expression and assign the result to var Example: sum:= <AddNumbers.wcl> Num1 Num2

Notes:

- A cited program must be a valid *.wcl file
- the angular brackets must be typed literally
- The cited program must be located in the directory of the current edited file
- If the cited program is not a valid While program, compilation will fail.

| The Case Command
|  | Syntax: case expression of pattern-1 => command-1 pattern-2 => command-2 . . pattern-N => command-N Meaning: Implementation of pattern matching as described in the textbooks Example: case number of (nil) => foo := bar; bar := nop; (nil Tail) => commands; Any => commands

Expressions

WIDE supports the standard expressions:

- constants - lists in tree (dotted-pair) or list notation; every list (except nil alone) must be enclosed in quotation marks, e.g., "(nil)".
- The while expressions hd E, tl E and cons E F.
  DO NOT use parantheses in expressions.

WIDE supports the following sugar expressions:

| List
|  | Syntax: (list expr-1 expr-2 ... expr-n) Meaning: Combine the values of the given expressions in a list Examples: Unary3 := (list nil nil nil) program := (list InVar Cmd OutVar)

| Expression Citation
|  | Syntax: 'dataFile' (a file name inside single quotes) Meaning: Read the file: dataFile and include its contents as a quoted constant (similar to the C language #include macro) Example: Say we have a file called 'myFile.txt' which contains the following line: (nil nil nil) The following commands are identical: data := cons 'myFile.txt' Num2 data := cons "(nil nil nil)" Num2