Week 1.2: Disambiguation

Homework
September 09, 2021

In this set of assignments, published on WebLab, we exercise the disambiguation of grammars following the material of Lecture 3.

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.