Compiler Construction 2013 
Computer Laboratory 
University of Cambridge 
Timothy G. Griffin (tgg22@cam.ac.uk) 

=============================================================
     Slang.2 Programming Excersises (in SML) 
=============================================================

These are recommended programing tasks, listed from easiest to 
more difficult. 

1) Parser.grm is modified from that of L2 in SPL.  The main change is 
that the lines 

| DEREF IDENT                            { Deref_raw $2 }

and 

| IDENT ASSIGN expr                      { Assign_raw ($1, $3) }

are replaced by the lines 

| DEREF IDENT                            { Deref(Var $2) }
| DEREF LPAREN expr RPAREN               { Deref $3 }

| IDENT ASSIGN expr                      { Assign (Var $1, NONE, $3) }
| LPAREN expr RPAREN ASSIGN expr         { Assign ($2, NONE, $5) }

That is, if the argument of ! or the left-hand-side of := is not 
an identifier, then it must be enclosed in ( ... ). I did this 
because the grammer with 

| DEREF expr                            { Deref $2 }

and 

| expr ASSIGN expr                      { Assign ($1, NONE, $3) }

results 17 shift/reduce conflicts.  See the output file 
Parser.VERSION1.output. 

Can you think of a better way to "fix" the grammar? 

2) Add tuples from L3. 

3) Add records from L3. 

4) Add inl,inr, and case from L3. 

5) Add objects 


=============================================================
     Slang.2 Programming Excersises (in C) 
=============================================================

0) Extend VSM to implement the language of AST_vsm_assembler.sml

2) Invent something similar for a VRM, AST_vrm_assembler.sml, and 
and extend the VRM. 


