Consider the and parsing tables for a context free grammar. Which of the following statement is/are true?
View worked solution
Answer: B;C;D
To compare the and parsing tables, we analyze their underlying state machines and construction rules:
-
State Machine Structure:
Both and parsers are based on the same set of states as the parser. Since the states and the transitions between them are identical:
- The goto transitions (on non-terminals) are identical in both tables. Thus, statement (A) is false.
- The shift actions (transitions on terminals) are identical in both tables. Thus, statement (B) is true.
-
Reduce Actions:
- In , for a state containing the item , a reduce action is placed under all terminals in .
- In , the reduce action is placed only under the specific lookahead terminals associated with that item in the merged state. Since these lookaheads are a subset of , the reduce entries can be different. Thus, statement (C) is true.
- Error Entries: Since the reduce entries can differ between the two tables, the blank cells (which represent error entries) will also differ. Thus, statement (D) is true.
Therefore, the correct statements are B, C, and D.
Free practice · Your answers on this page are not saved.
