1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

# Consider the grammar with the following translation rules and E as the start symbol. E→E1 #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 of the parse tree for the expression: 2 # 3 & 5 # 6 & 4.

A
200
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
180
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
40
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
160
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

## The correct option is D 160First we have to construct the parse tree. Then we construct the annonated parse tree or parse tree with value at the leaf node.

Suggest Corrections
4
Join BYJU'S Learning Program
Related Videos
Apartheid System
CIVICS
Watch in App
Explore more
Join BYJU'S Learning Program