Question: Consider the following BNF grammar G, based on the TinyC++ syntax: object-expression ::= id | id ( object-expression ) | object-expression . id | object-expression
Consider the following BNF grammar G, based on the TinyC++ syntax: object-expression ::= id | id ( object-expression ) | object-expression . id | object-expression [ object-expression ] | object-expression . id ( object-expression ) 1. Construct the sets of LR(1) items for G (the original grammar given above). 2. Merge the sets of items having common cores to give the set of LALR(1) items. 3. Construct the LALR(1) parsing table from the set of LALR(1) items. 4. Simplify the LALR parsing table using the compaction techniques discussed at the end of Section 4.7 (section 4.7.6). Note: you can simplify or rename the above terminals and nonterminals of the above grammar G so that it will be easier to construct the sets of LR(1) items for G: O ::= id | id ( O ) | O . id | O [ O ] | O . id ( O )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
