Which of the following are TRUE about the relationship between context-free grammars and LR parsing?
GATE CSE · Compiler Design
Master topic for Parsing. Includes Syntax Analysis, Top-Down Parsing, Bottom-Up Parsing, Error Detection & Recovery.
143 questions · 0 PYQs · 20 AI practice · GATE CSE 2027
Which of the following are TRUE about the relationship between context-free grammars and LR parsing?
An LR(1) item is a pair [A → α • β, a] where a is the lookahead symbol. What does the lookahead a represent?
Which of the following are valid error recovery strategies used in parsers?
Which of the following statements about cascaded errors (spurious errors) in compilers are TRUE?
Consider the grammar: E → E + T | T, T → T * F | F, F → (E) | id. Which of the following statements about this grammar are TRUE?
In an LALR(1) parser performing error recovery, after detecting a syntax error the parser pops states from the stack until it finds a state s such that a production with error on the right-hand side can be reduced. It then shifts the special error token. How many states are popped in the BEST case?
Which of the following correctly distinguishes LR(0), SLR(1), LALR(1), and CLR(1) parsers?
Which of the following grammars is NOT LR(1)?
In an LR parser, the parsing configuration is represented as a pair (stack, remaining input). For grammar S → aABe, A → Abc | b, B → d, trace the bottom-up parse of input 'abbcde'. How many reduce actions are performed?
Construct the SLR(1) parsing table for the grammar: S' → S, S → aAd | bBd | aBe | bAe, A → c, B → c. Does a conflict exist?
The number of errors that a good compiler should report before terminating is best described as:
Which of the following problems can arise in bottom-up parsing of an ambiguous grammar?
A compiler reports the error 'expression must have integral type' for the statement float x = 3.5; int arr[x]; in C. This is an example of:
In a shift-reduce parser, which of the following operations are performed?
How many distinct phases of a compiler can detect errors? (Count lexical analysis, syntax analysis, semantic analysis, intermediate code generation, and code optimisation as separate phases.)
The operator precedence parsing method is a simpler form of bottom-up parsing. Which of the following correctly describes it?
Consider the parsing table entry ACTION[s, a] = rk (reduce by production k). What actions does the parser perform?
Which of the following correctly describes the CLOSURE operation on a set of LR(0) items?
Which of the following parsing techniques are bottom-up parsing methods?
The following grammar is given: S → L = R | R, L → * R | id, R → L. Which conflict does SLR(1) parsing encounter on this grammar?
Want unlimited AI-generated Parsing questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →