edited by
879 views
0 votes
0 votes

Given the following statement: 6 * (8-3)
Make the Annotated Parse Tree based on the translation scheme below.

S → B {A.i = B.val} A {S.val = A.s}
A → - B {A1.i = A.i - B.val} A1 {A.s = A1.s}
A → e {A.s = A.i}
B → D {C.i = D.val} C {B.val = C.s}
C → * D {C1.i = C.i * D.val} C1 {C.s = C1.s}
C → e {C.s = C.i}
D → ( S ) {D.val = S.val}
D → num {D.val = num.val}

edited by

1 Answer

0 votes
0 votes
Ig we get 6 levels of nodes in the parseTree, and soln=30 (?)

Related questions

0 votes
0 votes
0 answers
1
ahmed65956 asked Sep 27, 2023
618 views
Give the translation scheme that converts infix to postfix form for the following grammar. Also generate the annotated parse tree for input string 2+6+1E- E+TE->TT->0|1|2...