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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!