Intermediate
Compilers & Programming Language Theory
Q62 / 100
What distinguishes an LR(1) parser from an LR(0) parser?
Correct! Well done.
Incorrect.
The correct answer is A) LR(1) uses one token of lookahead when deciding to reduce, allowing it to handle a strictly larger class of grammars than LR(0), which decides based on state alone
A
Correct Answer
LR(1) uses one token of lookahead when deciding to reduce, allowing it to handle a strictly larger class of grammars than LR(0), which decides based on state alone
Explanation
LR(0) items carry no lookahead, so many practical grammars produce conflicts. LR(1) attaches a lookahead symbol to each item, letting the parser decide whether to reduce based on what token follows, resolving many of those conflicts at the cost of larger tables.
Progress
62/100