MFT
(1) A grammar that produces more than one parse tree for some sentence is called ___________
a) Ambiguous
b) Non-Ambiguous
c) Regular
d) None of the mentioned BL[1]
(2) Syntax Analyser is also known as ___________
a)Hierarchical Analysis
b) Hierarchical Parsing
c) None of the mentioned
d) Hierarchical Analysis & Parsing BL[1]
(3) Syntax Analyser takes Groups Tokens of source Program into Grammatical Production.
a) True
b) False BL[1]
(4) _____________ features of assembler are Machine-Dependent?
a) Instruction formats
b) Addressing modes
c) Program relocation
d) All of the mentioned BL[1]
(5) The fourth Generation computer was made up of ______________
a) Transistor
b) Vacuum tubes
c) Chips
d) Microprocessor chips BL[1]
(6) _______________ derivations does a top-down parser use while parsing an input string. The input is
assumed to be scanned in left to right order.
a) Leftmost derivation
b) Rightmost derivation
c) Leftmost derivation traced out in reverse
d) Rightmost derivation traced out in reverse BL[1]
(7) The process of assigning load addresses to the various parts of the program and adjusting the code and data
in the program to reflect the assigned addresses is called___________
a) Assembly
b) Parsing
c) Relocation
d) Symbol Resolution BL[1]
(8) _________is the following statements is false.
a) An unambiguous grammar has the same leftmost and rightmost Derivation
b) An LL(1) parser is a top-down parser
c) LALR is more powerful than SLR
d) An ambiguous grammar can never be LR(k) for any K. BL[1]
(9) __________ is not aLR(0) item.
a) A->. Xyz
b) A->[Link]
c) A->xyz
d) None BL[1]
(10) In LL(1) first L stands for ____
a) Left most derivation
b) Scanning from left to right
c) Both A & B
d) None BL[1]
Long Answers
(11) Create a comparison between Native compilers, Cross compilers, and Just-In-Time (JIT) compilers using a
T-diagram. Highlight their differences in terms of target platform, compilation process, performance, and
deployment scenarios. Incorporate concepts such as bytecode, intermediate representations, and runtime
environments in your comparison. BL[3].
(12) Construct Predictive parsing table for the Following grammar.
ETE’
E+TE’| €
EFT’
T’*FT’|€
F(E)|id [BL-3].
(13)Find the First() and Follow() of following grammar and prove it is LL(1) or not.
SABC
Aa|b|€
Bc|d€
Ce|f|€ [BL-3]
(14) Compare and contrast LR parsers and LL parsers in terms of parsing strategy, grammar requirements, error
handling, and applications. Introduce concepts such as shift-reduce and reduce-reduce conflicts, lookahead
symbols, and grammar ambiguity in your comparison. Provide examples illustrating the differences between the
two parsing techniques and discuss their advantages and disadvantages. [BL-2]
(15) Construct the CLR Parser for the following grammar with table.
EBB
BcB/d [BL-3]
(16) Explain parsing techniques with a hierarchical diagram, illustrating the process of tokenization, parsing,
and syntax tree construction. Introduce concepts such as abstract syntax trees (ASTs), semantic analysis, and
intermediate representations (IR) in your explanation. Discuss how different parsing techniques handle lexical
and syntactic analysis, and how they contribute to code generation and optimization stages in compilation.
BL[2].
(17) Consider the following grammar
S → AS|b
A→SA|a construct the SLR parse table for the grammar. [BL-3]
(18)Define SLR(1) parser. Predict the following grammar for
generate the SLR parsing table.
E→E+T | T
T→T*F | F
F→F*| a| b
(19) S →0B|1A
A →0S|0|1AA
B→1|0BB|1S For the String 001101010 find Left Most Derivation and Derivation tree. [BL-3]
(20) Give the predictive parser for the following grammar.
S→ (L) | a L→ L, S | S
a) Give a rightmost derivation for (a,(a, a)) and show the handle of each right-sentential form.
b) Show the steps of a shift reduce parser [BL-3]
(21) Explain about the LALR Parser .
S->Aa|bAc|Bc|bBa
A->d
B->d find out it is LALR(1) or not. [BL-3]
(22) Explain the challenges and problems associated with Top-Down Parsing, including issues such as left
recursion, left factoring, non-determinism, and handling ambiguous grammars. Introduce concepts such as
LL(k) parsing, FIRST and FOLLOW sets, and error recovery strategies in your explanation. Discuss how these
problems affect the efficiency and correctness of the parsing process, and present techniques for addressing
them. BL[2].
(23) Show a Grammar is LL(1) or not.
S->ictS|iCtSeS|a
C->b [BL-3]
(24) Explain in detail the conflicts that may occur during Shift-Reduce Parsing, including Shift-Reduce
conflicts, Reduce-Reduce conflicts, and the concept of precedence and associativity. Introduce concepts such as
parser states, lookahead symbols, and parsing tables in your explanation. Discuss how these conflicts arise
during the parsing process and present strategies for resolving them. [BL-2]
(25) Find Canonical collection of sets of LR(0) items for grammar
S’->L
S->R
L->*R
L->id
R->L [BL-3]