0% found this document useful (0 votes)
29 views3 pages

CD Unit-1,2 Important

Uploaded by

21h51a0558
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

CD Unit-1,2 Important

Uploaded by

21h51a0558
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Compiler Design

short answer questions.


1.Define lexme,pattern,token
2.List and explain various types of errors
3.Difference between syntax and parse tree.
4.List the limitations of top-down parser.
5.Write the structure of lex program.
6.Write the block diagram of predictive parser.
7.What is left recursion.Eliminate the left recursion from grammar G.
E -> E + T/T
T -> T *F/F
F -> F* /a/b

8.List various error recovery methods.


9.Explain handle pruning
10.Define LL(1) grammar.
11.List the actions of LR parser.
12.What is recursive descent parsing.
13.Write the rules of FIRST and FOLLOW functions.
14.Write the syntax tree for the expression. a=(b+c)*(d+67)
15.List the phases of a compiler.

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)

2. a) Explain various issues in lexical analyzer generator.


There are three issues in lexical analysis: (TB 111)
 To make the design simpler.
 To improve the efficiency of the compiler.
 To enhance the computer portability.
https://ecomputernotes.com/compiler-design/lexical-analysis#Issues_in_Lexical_Analysis ->refer
Issues in Lexical Analysis

Lexical analysis is the process of producing tokens from the source program. It has the following issues:

• Lookahead
• Ambiguities

b).Explain the role of lexical analyzer generator (TP 2-2)+(TB 109)


https://www.guru99.com/compiler-design-lexical-analysis.html

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

6.(a)Explain the differences between compiler and interpreter. (TP 1-18)


(b) Explain the differences between phase and pass. (TP 1-20)

7.Explain the science of building a compiler. (TB 15)


http://www.brainkart.com/article/The-Science-of-Building-a-Compiler_8123/
DOUBTTTTTTT

8. Explain optimization of DFA-based pattern matchers

9. explain Thompson construction procedure to convert re to nfa? (TP 2-31)

10. (a)explain regular expressions with examples? (TP 2-9) write many examples
(b)explain the specifications of tokens? (TP 2-8)

UNIT-II

1. Construct predictive parse table for the following grammar.


E -> E + T/T
T -> T *F/F
F -> F* /a/b

2.(a) What are the limitations of recursive descent parser?

(b) What is left recursion? Remove left recursion from following grammar:
S -> Aa/b
A -> Ac/Sd/ e

3. Eliminate ambiguities in the following grammar.


S -> iEtS| iEtSeS| a
E -> b| c | d

4. Construct SLR parsing table for following grammar:


E -> E + T/T
T -> T * F/F
F -> (E)/id.
5.(a) Explain the stack implementation of shift reduce parsing method with an
example.
(b) Define handle. Give suitable example.

6. Construct recursive descent parser for the following grammar.


E -> T E’
E’ -> +T E’|e
T -> F T’
T’ -> *FT’|e
F -> (E)|id

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

8. Construct LALR Parsing table for the following grammar


S ->CC
C->cC|d

You might also like