UNIT II
UNIT II
SET A
Column A Column B
1. FOLLOW set a) Handles syntax errors
2. Top-Down Parsing b) Lookahead for Predictive Parsing
3. YACC c) Generates parser from grammar
4. Shift-Reduce Parsing d) Bottom-up Parsing
5. Panic Mode Recovery e) Recursive Descent Parser
Answer:
1 - b, 2 - e, 3 - c, 4 - d, 5 - a
Column A Column B
1. LL(1) Parser a) Top-Down Parsing
2. LR Parser b) Bottom-Up Parsing
3. Context-Free Grammar c) Type of Grammar used by LL(1)
4. Shift-Reduce Parser d) A type of Bottom-Up Parser
5. Predictive Parser e) Uses lookahead to predict parsing rules
Answer:
1. ____________ parsing uses the current input symbol to predict the next
rule to apply, considering one symbol of lookahead.
Answer: Predictive
2. In an ____________ parser, the syntax tree is constructed by reducing the
input symbols in a bottom-up manner.
Answer: LR
3. ____________ grammar is the type of grammar used by parsers that can
handle LL(1) parsing, where the leftmost derivation is used.
Answer: Context-Free
4. In a ____________ parser, the parser applies a shift or reduce operation to
move or reduce the symbols on the stack based on the input.
Answer: Shift-Reduce
5. ____________ mode of error recovery discards input symbols until a valid
state is reached in the parser.
Answer: Panic
Column A Column B
1. Top-Down a) Uses a single lookahead symbol to decide on the next
Parsing production
2. Shift-Reduce b) Involves moving input symbols onto the stack and
Parsing reducing based on grammar rules
c) Suitable for predictive parsing with one symbol of
3. LL(1) Parser
lookahead
d) A bottom-up parsing technique used for handling
4. SLR Parser
context-free grammars
5. Context-Free e) Describes the structure of tokens used in parsers like
Grammar LL(1) and LR
Answer:
1. A parser that uses a left-to-right scan of the input and constructs the
parse tree from the start symbol is called a ___________ parser.
Answer: Top-Down
2. In an LL(1) parser, the decision about which production rule to apply is
based on the current input symbol and _____________.
Answer: Lookahead symbol
3. The process of constructing a parsing table for a Shift-Reduce parser is
called ____________.
Answer: LR(0) Item Construction
4. In an LR parser, the state transitions are driven by ___________ actions
based on the current input symbol.
Answer: Shift/Reduce
5. ____________ parsing is a method of error handling where the parser
attempts to recover by deleting or inserting symbols in the input
stream.
Answer: Phrase-Level
Column A Column B
1. LR(0) Parsing a) Bottom-Up Parsing Technique
2. Recursive Descent Parsing b) Uses a stack to manage input
3. Phrase-Level Error Recovery c) Handles errors by skipping tokens
4. LL(1) Parser d) Top-Down Parsing Technique
5. Shift-Reduce Parsing e) A method used in Bottom-Up Parsing
Answer:
Column A Column B
1. Lexical Analyzer a) Uses shift and reduce actions to parse grammar
2. SLR Parser b) Bottom-Up Parsing
3. LL(1) Parser c) Predictive Top-Down Parsing
4. Finite Automata d) Recognizes patterns in tokens
5. YACC e) Generates parsers using LALR
Answer:
IV.True or False: