CD Unit-1,2 Important
CD Unit-1,2 Important
UNIT-I
1. Explain the different phases of a compiler, showing the output of each phase
using the example for the statement:
x=(a+b) * (c+d) (TP 1-6)
https://www.guru99.com/compiler-design-phases-of-compiler.html ->diagram->(TP 1-12)
Lexical analysis is the process of producing tokens from the source program. It has the following issues:
• Lookahead
• Ambiguities
3.Explain with one example how LEX program perform lexical analysis for the follow-
ing patterns in `C': identifier, keywords, numerical constants, arithmetic operators. (TP 2-55)
4. Explain the input buffer scheme for scanning the source program. How the use of
Sentinels can improve its performance? Describe in detail. (TP 2-6)
5.Construct an NFA for regular expression R= (a|/b)*abb convert it into an
Equivalent DFA. (TB 148,151)(TB 161)
http://www.cs.utsa.edu/~wagner/CS3723/fa/sa.html
HOW?
https://www.tutorialspoint.com/automata_theory/constructing_fa_from_re.htm ->case 4
10. (a)explain regular expressions with examples? (TP 2-9) write many examples
(b)explain the specifications of tokens? (TP 2-8)
UNIT-II
(b) What is left recursion? Remove left recursion from following grammar:
S -> Aa/b
A -> Ac/Sd/ e
7. (a) What is meant by a parser generator? Illustrate with examples using YACC
b) Construct LL(1) parse table for the above grammar
E -> E + T/T
T -> T *F/F
F -> F* /a/b