Complete the code to identify the type of parser that uses lookahead symbols and states.
The [1] parser uses lookahead symbols and states to decide parsing actions.
The CLR(1) parser uses lookahead symbols and states to make parsing decisions, making it more powerful than simpler parsers.
Complete the sentence to explain the main difference between LALR(1) and CLR(1) parsers.
LALR(1) parsers merge states from CLR(1) parsers to reduce [1].
LALR(1) parsers merge states of CLR(1) parsers to reduce the number of states, making the parser smaller and faster.
Fix the error in the statement about LALR(1) parsing.
LALR(1) parsing always has more states than CLR(1) parsing because it keeps all lookahead information in separate states like CLR(1). The blank is [1].
The statement is incorrect because LALR(1) parsing merges states to reduce the number of states compared to CLR(1), not increase them.
Fill both blanks to complete the explanation of lookahead in CLR(1) and LALR(1) parsers.
In CLR(1) parsing, lookahead symbols are stored in [1] states, while in LALR(1) parsing, lookahead symbols are merged in [2] states.
CLR(1) parsers keep lookahead symbols in separate states, while LALR(1) parsers merge these states to reduce the total number.
Fill all three blanks to complete the dictionary comprehension that filters grammar rules with lookahead greater than zero.
filtered_rules = { [1]: [2] for [3], lookahead in grammar_rules.items() if lookahead > 0 }This comprehension creates a new dictionary with rules and their lookahead values, but only includes those with lookahead greater than zero.
