Answered step by step
Verified Expert Solution
Link Copied!

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 Translatorsimage text in transcribedimage text in transcribedimage text in transcribed

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 reduce

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

4. What will the team agreement contain?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago