UNIT-1 COMPILER DESIGN
Important Questions (Collected from Previous Papers)
1. FINITE AUTOMATA (DFA/NFA)
1. Construct a DFA for any two specified tokens.
2. Write the regular expression for the following tokens.
3. Construct a DFA for recognizing identifiers and numbers.
4. Construct a DFA for floating-point numbers.
5. Construct a DFA for relational operators.
6. Construct a DFA for a given language based on constraints.
7. Design a finite automaton for a pattern consisting of three consecutive 1’s.
8. What is a finite automaton? Explain its types with examples.
9. Minimize the given DFA.
10. Convert the given NFA into a DFA using subset construction.
2. REGULAR EXPRESSIONS → AUTOMATA
11. Convert the given regular expression into an ε-NFA.
12. Convert the regular expression (a|b)*abb into DFA.
13. Convert a regular expression to automata using Thompson’s construction.
14. Draw the automaton for a given regular expression.
15. Explain the process of converting regular expression to DFA.
16. Build regular expressions for identifiers and numbers.
3. LEXICAL ANALYSIS – DESIGN & WORKING
17. Explain the role of a lexical analyzer.
18. Explain input buffering with diagrams.
19. Explain the concept of tokens, patterns, and lexemes.
20. How does the lexical analyzer interact with the parser?
21. Write the architecture of a lexical analyzer.
22. What is a token? List different token types.
23. Explain how lexical errors are handled.
24. Explain the working of the LEX tool.
25. Explain retraction and lookahead.
26. Explain the structure of a Lex program.
27. Design a lexical analyzer for identifiers and keywords.
28. Explain the responsibilities of the lexical analyzer phase.
4. RECOGNITION OF TOKENS
29. Explain token recognition using finite automata.
30. Describe token recognition for identifiers and numbers.
31. How are tokens recognized using patterns?
32. Explain with an example how a lexical analyzer generates tokens.
33. Write token definitions for operators, identifiers, and constants.
5. ROLE OF THE LEXICAL ANALYZER
34. Write a short note on the role of a lexical analyzer.
35. Explain how lexical analysis simplifies parsing.
36. Explain the functions performed by a lexical analyzer.
37. Why is buffering required in lexical analysis?
6. DFA-BASED PATTERN MATCHING & OPTIMIZATION
38. Explain optimization of DFA-based pattern matchers.
39. Write advantages of DFA in pattern matching.
40. Give the limitations of NFA in pattern matching.
41. Minimize a DFA and explain how minimization improves speed.
42. Explain the difference between NFA-based and DFA-based matching.
43. Describe the process of constructing minimized DFA for patterns.