Академический Документы
Профессиональный Документы
Культура Документы
Design
the transition diagrams for them.
2. b) Explain the three general approaches for the implementation of a
Lexical analyzer.
c) Compare compiler and interpreter with suitable diagrams.
3. a) Why lexical and syntax analyzer are separated out?
b) Construct the predictive parser for the following grammar
S -> (L) | a
L ->L,S | S
c) Give the classification of parsing techniques and briefly explain
each.
4. a) Parse the input string int id,id; using shift-reduce parser for the
grammar
S -> TL;
T -> int | float
L -> L,id | id
5. b) Write the steps for the efficient construction of LALR parsing table.
Explain with an example.
6. a) Write regular expressions for the set of words having a,e,I,o,u
appearing in that order, although not necessarily consecutively.
b) Construct NFA equivalent to regular expression r= (a + b)*ab.
c) Give general format for LEX program.
7. a) Show that the grammar S -> 0S1| SS | e is ambiguous.
b) Explain the Non-Recursive predictive parsing with an example.
c) What are the limitations of recursive descent parser?
8. a) Write the steps for the construction of CLR parsing table.
b) Explain the compaction of LR parsing tables with an example.
9. a) State the reasons for separating Lexical analysis and Syntax analysis
b) Describe the lexical errors and various error recovery strategies with
suitable examples.
c) Write a regular expression for relation operators. Design a transition
diagram for them.
10.
a) What is left recursion and left factoring?
b) Verify whether the following grammar is LL(1) or not?
E -> E + T | T
T -> T* F / F
F -> (F)|a|b.
c) Discuss about error recovery strategies in predictive parsing.
11.
a) Construct the collection of LR(0) item sets and draw the goto
graph for the grammar
S -> S S | a | e
Indicate the conflicts (if any) in the various states of the SLR parser.
b) Explain the process of handling Dangling-ELSE ambiguity.
12.
a) Draw a block diagram of phases of a compiler and indicate
the main functions of each phase.
b) Define lexeme, token and pattern. Identify the lexemes that make
up the tokens in the following program segment. Indicate
corresponding token and pattern.
Void swap(int I, int j)
{
int t;
t=I;
i=j;
j=t;
}
13.
a) What is an LL(1) grammar? When the grammar is said to be
LL(1) grammar?
b) Design a non-recursive predictive parser for the following grammar.
S -> AaAb | BbBb
A -> e
B -> e
c) Discuss how Brute-Force approach operates in top down parsing.
14.
a) Draw the structure of LR parser.
b) Compute closure(I) and goto(I) for the grammar
S -> Aa| bAc| Bc| bBa
A -> d
B -> d
c) Compare bottom up approaches of parsing with all top down
approaches.
15.
a) Define Language Processor? Differentiate between Compiler
and Interpreter.
b) Explain, in detail about the Various Phases of Compiler.
16.
a) Define Lexical Analyzer. Explain about the Role of Lexical
Analyzer.
b) Define Regular Expression. List out the Algebraic laws of Regular
Expressions.
17.
Construct a Predictive Parsing Table for the grammar
E->E+T | T
T->T*F |F
F-> (E) | id
18.
a) Differentiate between LR and LL Parsers.
b) Explain, in detail about Shift Reduce parser.
19.
Construct CLR Parser for the Grammar
S->L=R | R
L->a|*R
R->L
20.
a) Differentiate between Pass and Phase of Compiler.
b) Define Loader. Explain about different types of Loaders.
21.
a) Define the following
(i)Token
(ii) Pattern (iii) Lexeme
38.
(i) (a,a)
(ii) (a, (a , a))
(iii) (a, ((a , a), (a , a)) )
b) What are the differences between LL(1) Parsing and LL(k) Parsing?
49.
a) Construct the LR(0) items for the dangling-else grammar.
b) Write an algorithm for constructing LALR Parser table.
50.
a) What is a handle? Explain the method of handle pruning with
an example.
51.
b) Explain the various actions performed by shift-reduce parsers
with an example.
52.
a) Explain the phases in detail. Write down the output of each
phase for the expression
a: = b + c *50.
b) Give and explain the diagrammatic representation of a language
processing system.
53.
a) What is meant by input buffering? Explain the use of sentinels
in recognizing tokens.
54.
b) Explain the functions of lexical analyzer with its
implementation.
55.
a) Calculate FIRST and FOLLOW sets for the following grammar:
E->TE
E-> +TE | e
T->FT
T-> *FT | e
F-> (E) | id
b) Explain the model of a non-recursive predictive parser with an
example.
56.
a) Differentiate between LR parsing and LALR Parsing with an
example.
b) Compute LR(0) items for the following grammar:
S->AB
A->a | e
B->b | e
57.
a) What is a shift reduce parser? Mention the conflicts that occur
during shift-reduce parsing.
b) Explain the way to implement a shift-reduce parser using a stack by
taking an input string for a grammar.