Assignment 2
Assignment 2
Q.2 (a) Consider the following grammar . What is the total number of handles in the right
sentential form for the string
(b) Consider the following grammar G1 and G2. Find which grammar G1 and (or) G2 are
Ambiguous or not?
G1: G2:
(c) Consider the grammar a X +SY | Yb | What is the cardinality (Number of elements)
of FOLLOW(S) ?
a) Generate the operator precedence relation table (OPRT) for this grammar.
b) Parse the string using OPRT
c) Construct an operator function table (OFT) for OPRT
d) Discuss the advantages of OFT over OPRT.
Q.5 (a) Consider the following grammar . The total number of handles in the
right sentential form for the string is ………….
Consider the following grammar G1 and G2. Find which grammar G1 and (or) G2 are
Ambiguous or not?
G1: G2:
Consider the grammar: . What is the cardinality (Number of elements) of FOLLOW(S) ?
7.Write the Three-Address Code (TAC) for the following function that processes a 3D array.