Question: Consider a simplified CFG for the set language: (1) exp ? exp MINUS term (2) | term (3) term ? term UNION factor (4) |
Consider a simplified CFG for the set language:
(1) exp ? exp MINUS term (2) | term (3) term ? term UNION factor (4) | factor (5) factor ? LPAREN exp RPAREN (6) | LCURLY LIST RCURLY
Note: lower-case symbols are nonterminals, upper-cases symbols are terminals
Answer the following questions related to LR parsers, show all works of how you get these answers.
a. Write all possible items for production rule (5): factor ? LPAREN exp RPAREN
b. I1 = { term ? term UNION . factor }. Find out Closure(I1)
c. I2 = { factor ? LPAREN . exp RPAREN }. Find out Closure(I2)
d. I3 = { exp ? . exp MINUS term; exp ? exp . MINUS term ; exp ? exp MINUS . term }, X = MINUS. Find out Goto(I3, X)
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
