In this set of assignments, published on WebLab, we exercise the disambiguation of grammars following the material of Lecture 3.
You can make the assignments directly in WebLab, but we recommend following the instructions to set up a Spoofax project to make the assignments in Spoofax.
The template for the assignments this week is: given this (ambiguous) context-free grammar:
Show that the grammar is indeed ambiguous by giving a sentence and at least two different left-most derivations for that sentence and the corresponding abstract syntax trees.
Disambiguate the grammar using declarative disambiguation rules to indicate the associativity and priority of operators.
Transform the grammar to an unambiguous grammar with equivalent abstract syntax trees for sentences.
We also provide an assignment to exercise disambiguation using layout constraints.