Options Dialog
The Options Dialog allows you control some linguistic features.
Syntatic Sugars Dialog:
In this dialog you can select which Syntatic sugars will be supported by the WIDE Compiler.
Note that after deselecting some of the checkboxes, your while programs may not compile.
1.List Sugar
The List Sugar replaces an expression such as:
x := (list a b c nil);
With:
x := cons a cons b cons c cons nil;
2.Else Sugar
The Else Sugar allows you to omit the 'else' clause in if commands.
A command such as:
if expr then
Commands
Will compile into:
if expr then
Command
else
x := x
3.Case Sugar
The Case Sugar is a Pattern Matching Command.
Syntax:
case expr of
Pattern(1) => Command(1);
Pattern(2) => Command(2);
...
Pattern(n) => Command(n)
The Execution of the Command is as follows:
- Compute expr and save its value: E
- Scan Patterns(1..n) in the order they are written until finding the first pattern matching E
- Once Pattern( i ) is found, assign all its variables with
the corresponding subtrees of E
- Execute Command( i )
4.Booleans Sugar
The Booleans Sugar allows you to use the keywords: true and false as Boolean literals.
false will compile into nil
true will compile into (nil)