S→ pZ {print a}
S→ p {print b}
Z→ Sq {print c}
Using the above SDTs, the output printed by a bottom-up parser, for the input “ppq”
S-> (S) { S.count =P1}
S-> SS { S.count = P2}
S-> ϵ {S.count = 0}
If the above SDT count the number of balanced parenthesis, then select the correct value of P1 and P2 from options.
S1: A parse tree showing the values of its attributes is called annotated parse tree.
S2: The process of computing the attribute values at the nodes is called annotating the parse tree.
Select the correct option.
S1: The drawback for quadruple representation of 3-address code is it requires more space compared to triple notation.
S2: The drawback of indirect triples is that it requires two memory access.
S→AB
A→ val {print (val) }
B→ *A {print (+) } B | ϵ
For the input string: 1*2*3, what will be output?
Rule 1: B.i=A.i+5, C.i=B.i+A.i and A.s=B.s+C.s
Rule 2: X.i=A.i+Y.s , and Y.i=X.s +A.i
Select the correct option.
S → aSb {S.val = S.val+2}
| bSa {S.val = S.val+2}
| ϵ {S.val = 0}
The above SDT performs: