{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# HM8-Ambiguity-NormalForms-Answers - CS 341 Automata Theory...

This preview shows pages 1–2. Sign up to view the full content.

CS 341 Automata Theory Elaine Rich Homework 8 Due: Thursday, March 8, 2007 This assignment covers Sections 11.7 - 11.8. 1) Let G be the ambiguous expression grammar of Example 11.14. Show at least three different parse trees that can be generated from G for the string id + id * id * id . 2) Consider the unambiguous expression grammar G of Example 11.19. a) Trace the derivation of the string id + id * id * id in G . E E + T T + T F + T id + T id + T F id + T F F id + F F F id + id F F id + id id F id + id id id b) Add exponentiation ( ) and unary minus (-) to G , assigning the highest precedence to unary minus, followed by exponentiation, multiplication, and addition, in that order. R = { E E + T E T T T F T F F F X F X X - X X Y Y ( E ) Y id }. 3) Let L = { w { a , b , , ε , (, ), *, + }* : w is a syntactically legal regular expression}. a) Write an unambiguous context-free grammar that generates L . Your grammar should have a structure similar to the arithmetic expression grammar G that we presented in Example 11.19.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern