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;
Else Sugar
The Else Sugar allows you to ommit the 'else' keyword in if commands;
A command such as:
if expr then
Commands
Will compile into:
if expr then
Command
else
x := x
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 which the matches E
- Once Pattern( i ) is found, assign all its variables with the right subtrees
- Execute Command( i )
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)