CD Question Bank
CD Question Bank
Question bank
Unit – 1
1. What is the role of regular expression in lexical analysis? Explain with
examples.
2. Describe the lexical error and various error recovery strategies with
suitable examples.
3. Explain briefly about input buffering in reading the source program for
finding the tokens.
4. Write a LEX program that recognizes the tokens in C and use the LEX
compiler to construct a lexical analyzer for C.
5. Write a regular expression for relation operators. Design a transition
diagram for them.
6. Give a brief on specification and recognition of tokens.
7. Write a short note on compiler construction tools.
8. What are the issues in lexical Analysis? Design lexical analyzer.
9. Write a lexical analyzer program to identify strings, Sequence,
comments, Reserved words and identifiers.
10.Explain about input buffering in lexical analyzer.
11.Differentiate tokens, pottering, and lexeme.
12.Define Regular Expressions and Regular Grammer.
13.Write a short note on Bootstrapping.
14.Explain LEX tools and a Lex program?
15.What is the relationship with lexical analyzer. Regular expression and
transition diagram? Give an example.
16.Describe the role of lexical analysis in compiler design.
17.Why is buffering used in lexical analysis? What are the commonly used
buffering methods?
Unit-2
1. With neat sketch explain the structure of L/L parser and the rules to
compute L/L item.
2. Explain about Left factoring left recursion with an example?
3. What is Left factoring and Left recursion of the following grammar
E→E+T/T, T→T*F/F, F→(E) / id and parse the string id+id*id.
4. Text whether the grammar is LL (1) or not, and construct a predictive
parsing table for following grammar.
S →iEtSSl / a, S1 → eS / E, E → b.
5. What is LL(1) parser? Construct the LL(1) Parser for G:S-> l a, L-> L, S IS
and check the acceptance of input string (a,(a,a)).
6. Discuss the process of error recovery in predictive parsing.
7. What is recursive descent parsing? Explain with an example.
8. Construct the predictive parsing table for the grammar.
S → iCtS S → iCtSeS S→a S→b
9. Explain Context free grammars with examples.
10.How to prove the following grammar as LL(1) ?
G. bexpr → bexpr or bterm l bterm,
Bterm → bterm and bterm l bfactor
Bfactor → not bfactor l (bexpr) l true / false.
11.“Top-down parser is also considered as Left Most derivation “justify this
an example top-down passer.
12. What is recursive descent parsing? Write recursive descent parser
for the following grammar after doing necessary transformations
E→E+TlT
T→T*FlF
F → (E) / id
13. What are the difficulties with top-down parsing? Eliminate the left
recursion from the grammar
S→ Aa l b
A → Ac l Sd Ie