Question

Compster Science epene CS 347 Compiler Design Assiznment 2 Due Date: October 28, 2018 Exercise 1 Consider the following grammar: cassign expr l <id> a) Show that this grammar is ambiguous. b) Do the necessary changes to make it unambiguous (you should consider that has more priority than -). Exercise 2 Consider the following BNF Grammar: A [B, A] | B B: CI(A; C) D::= a | b | c For each of the strings listed below, indicate all the non-terminals that can generate it a) [c, (b; a) c) IIla, b], c], a Exercise 3 Consider the following grammar: b) [(a; (b), [(a; c), fa ll S- Aa ABD a) Compute the First set for each right-hand side and the FOLLOW set for each non terminal of the grammar above. b) Construct the predictive parsing table for t c) Is this grammar LL(1)? Why or Why not? d Provide the LI(U narsing stens for the following expression: bdbdddaS. he grammar above.

for compiler design

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
for compiler design Compster Science epene CS 347 Compiler Design Assiznment 2 Due Date: October 28,...
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
  • (10] Eliminate left recursion from the grammar A Ba |Aa c B Bb | Ab 1...

    (10] Eliminate left recursion from the grammar A Ba |Aa c B Bb | Ab 1 d A Ad IB A BA ASJAE Consider the following grammar G: S'S S (S)S|e fa) (10] Construct the collection of the sets of LR(0) items (b) [5] When constructing the action table of SLR parser of G what are the rules to determine the parsing actions? That is, what is the rule for a shift action at state /? What is the rule...

  • Consider the following BNF grammar that we saw in class:        EXP    ::= EXP + TERM  ...

    Consider the following BNF grammar that we saw in class:        EXP    ::= EXP + TERM   | EXP - TERM    | TERM        TERM   ::= TERM * FACTOR | TERM / FACTOR | FACTOR        FACTOR ::= ( EXP ) | DIGIT        DIGIT ::= 0 | 1 | 2 | 3    (a) Translate into EBNF.    (b) Draw syntax diagrams.    (c) What are the two requirements on a grammar for a predictive parser to be able to...

  • Question Set 2 1. Given the following grammar dactor>-> ( <expr> ) a) What is the...

    Question Set 2 1. Given the following grammar dactor>-> ( <expr> ) a) What is the associativity of each of the operators? What is precedence of the operators? Show a leftmost derivation and parse tree for the following sentence: b) c) A-A(B(C A)) d) Rewrite the BNF grammar above to give precedence over and force to be right associative.

  • Question Set 2 1. Given the following grammar dactor>-> ( <expr> ) a) What is the...

    Question Set 2 1. Given the following grammar dactor>-> ( <expr> ) a) What is the associativity of each of the operators? What is precedence of the operators? Show a leftmost derivation and parse tree for the following sentence: b) c) A-A(B(C A)) d) Rewrite the BNF grammar above to give precedence over and force to be right associative.

  • I need help with the following problems, any help you can provide is deeply appreciated! CSC...

    I need help with the following problems, any help you can provide is deeply appreciated! CSC 404 Exam 1 Question I continued - 9. The syntax rules for most languages ignore spaces. An exception is which tises indents and therefore spaces to form the indents) to group statements (a) FORTRAN (6) Pascal (e) Python (d) Lip (e) C++ 10. Identifiers, constants and operators are typical examples of (a) tokens. (b) leafons. (c) signifiers. (d) lexicons. (e) parsicles. 0) non-terminals. 11....

  • 1. (p. 2-3.) Which of the following is NOT a reason for studying concepts of programming...

    1. (p. 2-3.) Which of the following is NOT a reason for studying concepts of programming languages according to Sebesta? a. Increased capacity to express ideas. b. Improved background for choosing appropriate languages. c. Increased ability to design new languages. d. Increased ability to learn new languages. 2. (p. 5-6.) What programming language has dominated scientific computing over the past 50 years? a. FORTRAN b. ALGOL c. SNOBOL d. PL/I 3. (p. 6.) What programming language has dominated artificial intelligence...

  • 3. You're so thrilled by your geometric and designing capabilities (see problems 1 and 2) that you decide to design a thin dinner plate that on your blueprint covers the region between the r-...

    3. You're so thrilled by your geometric and designing capabilities (see problems 1 and 2) that you decide to design a thin dinner plate that on your blueprint covers the region between the r-axis and the curve To impress the friends, you decide to make two versions of the plate and exhibit them by holding them up on a single finger. In order to do this, you need to calculate the center of mass of each. (a) (5 points) One...

  • Principles of Computer Science

    Question First, you need to design, code in Java, test and document a base class, Student. The Student class will have the following information, and all of these should be defined as Private: A. Title of the student (eg Mr, Miss, Ms, Mrs etc) B. A first name (given name) C. A last name (family name/surname) D. Student number (ID) – an integer number (of type long) E. A date of birth (in day/month/year format – three ints) - (Do NOT use the Date class from...

  • Dr. C. #2. (PHYS 121 engineering design exercise) You have seen why cars inherently accelerate qu...

    Dr. C. #2. (PHYS 121 engineering design exercise) You have seen why cars inherently accelerate quicker in a straight line and have better fuel mileage than an SUV with the same engine; it's because of air drag and the smaller frontal area and better drag coefficient of the car. Now let's think about why cars handle (take turns, change lanes and make other quick maneuvers) better than an SUV. We'l1 simplify our analysis by considering a vehicle of mass M...

  • Can someone do 28, 32, 40, and 44 198 CHAPTER 3 Probability c. Use the results of parts a and b to find ed value of Ca...

    Can someone do 28, 32, 40, and 44 198 CHAPTER 3 Probability c. Use the results of parts a and b to find ed value of Cash 4 admission to college); the Law School Admissions Test, or LSAT; and the Graduate Record Exam, GRE (used for admission to graduate school). 32. New York's "Pick 10" is a 10/80 lottery Sometimes, these maltiple-choice tests discourage guessing by subtracting points for wrong answers In particular, a correct answer will be worth +1...

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
ADVERTISEMENT