Question: Exp Exp + Exp Exp Exp - Exp Exp Exp * Exp Exp Exp / Exp Exp num Exp ( Exp ) Grammar 2.2 -
Exp Exp+Exp
Exp Exp- Exp
Exp Exp*Exp
Exp Exp / Exp
Exp num
Exp ( Exp)
Grammar 2.2 -
Stat id := Exp
Stat Stat ; Stat
Stat if Exp then Stat else Stat
Stat if Exp then Stat
In Grammar 2.2 , replace the operators and / by < and :
These have the following precedence rules:
< is non-associative and binds less tightly than + but more tightly than :
: is right-associative and binds less tightly than any other operator
Write an unambiguous grammar for this modified grammar using the method shown in Sect.2.3.1.
Show the syntax tree and the fully reduced syntax tree for 2 : 3 < 4 + 5 : 6 7 using the unambiguous grammar.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
