We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
: (Printed Pages : 4) Roll No. .....
| AC-1947
B.E. VI Semester (New Course) Examination, May-2022
Compiler Design
CSE
Time : Three Hours ] [Maximum Marks : 60
[Minimurm Marks: : 24
Section - A
Note : All questions are compulsory. Objective Type/True & False. 1x10=10
1, In a compiler, keywords of a language are recognized during?
(a) Parsing of the program
(b) Syntax analysis
§6) The lexical analysis of the program
(d) Dataflow analysis
A compiler program written in a high level language is calied
N
{a} Source Program
(b) Object Program
(c) Machine Language Program
{a) None of the above
mantic Analyzer is used for
(a) Maintain symbol table
(b) Generating object code
(9 None of these
(d) Both of these
4, Ina bottom up evaluation of syntax directed definition, inherited attribute
can
(a) always be evaluated
{2J be evaluated only if the definition is L attributed.
(c)_ be evaluated only if the definition hassynthesized attributes
(d) - never be evaluated.
P.T.O.2
10.
Which of these is not true about Symbol Table?
(a) All the labels of the instructions are symbols
(b) Table has entry for symbol name address value
(p) Perform the processing of the assembler-directives
(d) Created during pass.
The lexical analysis for a modern computer language such as Java needs
the power of which one of the following machine models in a necessary
and sufficient sense?
J) Finite state Automata
(b) Deterministic push down automata
(c) Non deterministic pushdown automata
(d) Turing machine.
Given the following expression grammar :
Fo> Ea FL F+E|F
F->F-Flid
identify which one of the following is true?
(a) * has higher precedence than +
) = has higher precedence than *
(c)_ + and - have same precedence
(d) + has higher precedence than *
nich of the following symbol table implementation is based on the
property of locality of reference?
(a) Linear list (p) Search tree
(c) Hash table (d) Self organization list
Which one of the following is TRUE at any valid state in shift-reduce
parsing?
(a) Viable prefixes appear only at the bottom of the stack and not
(b) Viable prefixes appear only at the top of the stack and not inside
(9 The stack contains only a set of viableprefixes.
(d) The stack never contains viable prefixes.
Which of the following derivations does a top-down parser use while
parsing an input string?
(a) Leftmost derivation
(b) Leftmost derivation in reverse
(c)_ Rightmost derivation
(d) Rightmost derivation in revesrse
AC-1947 (2)Section - B
Note : Attempt four questions are compulsory out of six. 5x4=20
1, Perform Shift Reduce parsing for input string “baaab$". Check whether
the given string is the part of following grammer. Proof with the help of
stack.
S-> AA A->aAlb
‘Action Goto
a b $s s A
0 S, (in state 0S, I(in stateo [2
goto oper- goto oper-
ation ona ation on S
goes to state goes to state
3) Dy
1 Accepted (S
is reduced
to strong
accepted)
s s
S S,
R, (instate [R, (reduced [R,
4produc- | entry writ-
tion3is | ten under
reduced) —_|all the non
terminals)
R R R,
R R R
B For the following sub-problems, consider the following grammar :
SAB ASxA A+B BoyzB Boz
(a) What are the terminals and non-terminals of this grammar?
(b) Show the parse tree for xyzzz$.
A. (a) What are the first and follow sets for each of the non-terminals of the
above grammar?
(b) Give the parse table for this grammar, Is this an LL (1) grammar?
AC/1947 (3)~ Classify synthesized translation and inherited translation.
Describe the design issue of code generation.
6. Explain Top Down Parsing and Bottom up parsing in Detail?
Section - C
Note : Attempt three questions are compulsory out of five. 10x3=30
1/ Explain all the necessary phase of compiler design. Write down the pur-
pose of each phase.
2. (a) Sketch LR (0) parsing table with its algorithm.
(b) Construct parsing table for following grammar.
EsE+T/T
Tid
3. Demonstrate the quadruples, triple and indirect triple for the following
expression
Octy)* (y+2)* (xty+z)
4. Considering the following left recursive grammar and eliminate the left
recursion and also sketch the predictive parsing table :
E+E+T/T
TT Ff
fF > a/b
oe Construct SDT to convert infix exp:
SAS {printf(1j}
~ SAB {printf(2)}
Asa {printf(3)}
B-bC {printf(4)}
Bo dB {printf(5)}
Ce {printi(6)}
Input > aaadbe
1 inte postfix.
AC-1947 (4)