Question 26
Which of the following LR parsers is the most powerful (handles the largest class of context-free grammars)?
CLR(1) maintains distinct lookahead contexts for every item, making it strictly more powerful than LALR(1), SLR(1), and LR(0).
Which of the following LR parsers is the most powerful (handles the largest class of context-free grammars)?
CLR(1) maintains distinct lookahead contexts for every item, making it strictly more powerful than LALR(1), SLR(1), and LR(0).
LALR(1) parsing tables are constructed by merging states of a CLR(1) parser that have:
LALR(1) reduces CLR(1) table size by combining states that share identical LR(0) item cores, merging their lookahead sets.
Merging states with identical LR(0) cores in a CLR(1) parser to create an LALR(1) parser can NEVER introduce which type of conflict?
Merging states with identical cores cannot introduce Shift-Reduce conflicts (if an S/R conflict wasn't present in CLR(1)). However, it CAN introduce new Reduce-Reduce conflicts.
In bottom-up shift-reduce parsing, a 'Handle' is defined as:
A handle is a substring that matches a production RHS and whose reduction step by step reverses a valid rightmost derivation.
Which grammar rule transformation eliminates common prefixes to enable predictive top-down parsing?
Left factoring rewrites rules with common prefixes (e.g. A -> alpha beta1 | alpha beta2 into A -> alpha A') so the parser can defer choice until lookahead reveals the suffix.