Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question about Programming Translators 1. The goal is to develop an SLR(1) parser for the grammar below. Rule 0 has been added to make the
Question about Programming Translators
1. The goal is to develop an SLR(1) parser for the grammar below. Rule 0 has been added to make the starting point for parse unique. There are 5 rules and the follow sets are Follow(S)-Follow(7)-(X, #, ( , ", "J (The language is for n-tuples of x's, with the outermost pair of parentheses optional. Examples include X, (, x, x) and (x, (X, X, x)) [25 points] Develop the SLR parsing characteristic finite state machine for this grammar. Start with the initial LR(0) item. S' S #, then include its S closure items, which will force you to include the T items. For each item in the state, indicate the action to be taken. The first couple of lines of the machine description are shown below. The action "s2" means shift and go to state number 2. The action "srl" means "shift then reduce using rule 1. (For uniformity, I'll apply "shift" to both terminals and nonterminals) You'll need five states containing a total of 17 items. For grading, the baseline is 5 points per state (more or less, depending on how many items the state contains) State # 1 Item Action s2 srl on Follow(S) (Note: "on Follow(S)" means "If the next character E Follow(S), then reduce" 1. The goal is to develop an SLR(1) parser for the grammar below. Rule 0 has been added to make the starting point for parse unique. There are 5 rules and the follow sets are Follow(S)-Follow(7)-(X, #, ( , ", "J (The language is for n-tuples of x's, with the outermost pair of parentheses optional. Examples include X, (, x, x) and (x, (X, X, x)) [25 points] Develop the SLR parsing characteristic finite state machine for this grammar. Start with the initial LR(0) item. S' S #, then include its S closure items, which will force you to include the T items. For each item in the state, indicate the action to be taken. The first couple of lines of the machine description are shown below. The action "s2" means shift and go to state number 2. The action "srl" means "shift then reduce using rule 1. (For uniformity, I'll apply "shift" to both terminals and nonterminals) You'll need five states containing a total of 17 items. For grading, the baseline is 5 points per state (more or less, depending on how many items the state contains) State # 1 Item Action s2 srl on Follow(S) (Note: "on Follow(S)" means "If the next character E Follow(S), then reduceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started