Program --> "begin", Statement, "end" Statement --> Variable, ":=", Expression Expression --> Expression, "#", SubExpr Expression --> Value SubExpr --> SubExpr, "$", Value SubExpr --> SubExpr, "?", Value Value --> Variable Value --> QuadInt | Variable --> "w" Variable --> "x" Variable --> "y" Variable --> "z" QuadInt --> "0" QuadInt --> "1" QuadInt --> "2" QuadInt --> "3" |
Sketch the parse tree for the following program, and explain what the precedence and associativity rules for the #, $, and ? operators must be.
begin x := 3 $ x # y ? z $ 2 end |