Question

Write a program that constructs the ACTION and GOTO parse tables for an SLR parser. Method for doing this is algorithm 4.46 (Purple Dragon Book) pg 253 Algorithm 4.8 (Red Dragon Book pg 227 Algorithm to do this is briefly described in Feb 16 notes, Shift-Reduce parser that uses these tables is described in Feb 9 notes. Once you have the ACTION and GOTO tables it is easy to construct your own sLR parsen. Given your program, construct the SLR parse tables for the augmented expression grammar: S E- E+T E- >T T- T F T- F F- i F- (E) Input format should be the same as for Lab6; define your own output format. Report if any states contain shift-reduce or reduce-reduce conflicts. Resolve all shift-reduce conflicts (if any) in favor of shift Answer the questions 1 Is the given expression grammar in SLR? Note that if there are shift-reduce or reduce reduce conflicts the answer is NO.) 2> If there were shift-reduce conflicts, your program should set the state where the conflict occurs to SHIFT this is what YACC does, and it works much of the time will this default action be correct in this case assuming the grammar was not SLR)?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

丁2 Le) ーゲ下5 06-06-2017 18:39

iの 06-06-2017 18:39

Program for SLR

PinteC adey the no.of leamns): Scanf I ..d , , &t) ; Cc tol ble ant (/s table C3csD: 33 prntf (In SLR TAGLE:In); en en pOP

Add a comment
Know the answer?
Add Answer to:
Write a program that constructs the ACTION and GOTO parse tables for an SLR parser. Method...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a parser program for cSub using the method of recursive descent. The main program here...

    Write a parser program for cSub using the method of recursive descent. The main program here will effectively be the main program of the compiler as a whole. The input to the program will be a Csub source file, specified on the command line. The program will construct a parse tree for the program, with one interior node for every nonterminal in the derivation of the program, and one leaf node for each of the id, num, and real tokens...

  • Write a java program for the following: Your program reads an infix expression represented by a...

    Write a java program for the following: Your program reads an infix expression represented by a string S from the standard input (the keyboard). Then your program converts the infix expression into a postfix expression P using the algorithm. Next, your program evaluates the postfix expression P to produce a single result R. At last, your program displays the original infix expression S, the corresponding postfix expression P and the final result R on the standard output ( the screen...

  • You shall develop a grammar and implement a parser which recognizes valid statements as described below in the assignment specification. You may develop your code using C, C++. The test file include...

    You shall develop a grammar and implement a parser which recognizes valid statements as described below in the assignment specification. You may develop your code using C, C++. The test file include these expressions below. The first six should pass and the rest should fail: first = one1 + two2 - three3 / four4 ; second = one1 * (two2 * three3) ; second = one1 * (two2 * three3) ; third = ONE + twenty - three3 ; third...

  • Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as...

    Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as a Constraint Satisfaction Problem, with the following guidelines: 1. Since 3 x 3 puzzles are too trivial for a computer, your program should use 4 x 4 puzzles (also known as Super Sudoku puzzles; see Figure 2 for an example). 2. The program should read a Sudoku puzzle from a text file. The user should be able to browse the file system to select...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

  • I need Summary of this Paper i dont need long summary i need What methodology they used , what is the purpose of this p...

    I need Summary of this Paper i dont need long summary i need What methodology they used , what is the purpose of this paper and some conclusions and contributes of this paper. I need this for my Finishing Project so i need this ASAP please ( IN 1-2-3 HOURS PLEASE !!!) Budgetary Policy and Economic Growth Errol D'Souza The share of capital expenditures in government expenditures has been slipping and the tax reforms have not yet improved the income...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT