Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. Consider the grammar with the following translation rules and E as the start symbol:
    E → E #T {E. value = E1 value * T. value}
    | T {E. value = T. value}
    T → T1 & F {T. value = T1 value F. value}
    | F {T. value =F. value}
    F → num {F. value = num. value}
    Compute E value for the root ofthe parser tree for the expression
    2 # 3 & 5 # 6 & 4.
    1. 200
    2. 180
    3. 160
    4. 40
Correct Option: D

The parse tree would be

Now we evaluate bottom up

LL " left to right left most derivation no ambignity should be there SLR or LR(0) L to R reverse right sentential form create LR(0) items. CLR or LR(1) create LR(1) items no bound LALR reduced CLR if while reducing any conflict found then not LALR Hence (c) is correct option.



Your comments will be displayed only after manual approval.