PCC CS501
PCC CS501
PCC CS501
TECH(N)/ODD/SEM-5/5506/2022-2023/I139
1/2
7. For the following grammar [ 3+5+5+2 ]
E-> E or T|T
T->T and F|F
F-> not F|(E)| 0|1
a) Eliminate left recursion from the above grammar
b) Find FIRST(X),Follow(X) for each variable in the grammar
c) Construct a predictive parser table for the grammar
d) Is the above grammar LL(1). Justify your answer
8. a) What is a compiler? [ 2+10+3 ]
b) Explain the different phases of compiler with an example
c) Compare and contrast between a compiler and an interpreter
9. i) Express the expression y=(a+b)*c in [ 9+6 ]
a.)postfix notation
b.) Abstract syntax tree
c). Three address code
ii) Implement the TAC using
a. quadruples
b. triples
c. indirect triples
10. Consider the regular expression (a+b)*a(a+b)(a+b) [ 3+6+3+3 ]
I. Augment the expression and construct the syntax tree for the above regular expression
II. Find Firstpos() and Lastpos() for every internal node in the syntax tree
III. Find Followpos() for every position in the syntax tree
IV. Construct the corresponding DFA for the given RE using Followpos()
11. a) What is LEX? [ 1+5+9 ]
b) Explain the working of LEX
c) Show the step by step construction of a lexical analyzer with the following three tokens
•a
• abb
• a*b+
2/2