1 / 7

Homework #3

Homework #3. J. H. Wang Nov. 1, 2011. Homework #3. Chap. 4 4.1 (c) 4.7 (c) 4.8 (a)(b)(c) 4.11. Chap. 4

airell
Download Presentation

Homework #3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Homework #3 J. H. Wang Nov. 1, 2011

  2. Homework #3 • Chap. 4 • 4.1 (c) • 4.7 (c) • 4.8 (a)(b)(c) • 4.11

  3. Chap. 4 • 4.1: For each of the grammars below, describe the language associated with the grammar and determine if the grammar is ambiguous. If the grammar is ambiguous, show two parse trees for the same string (see Fig. 4.3). Otherwise, explain why the grammar is not ambiguous.(c) SA B AA a | A b | a BB a | B b | b

  4. 4.7: Describe the language denoted by each of the following grammars:(d) ({A,B,C}, {a,b,c}, {ABB, Ba, Bb, Bc}, A)

  5. 4.8: A grammar for infix expressions follows: Start  E $ E  T plus E | T T  T times F | F F  ( E ) | num(a) Show the leftmost derivation of the following string. num plus num times num plus num $(b) Show the rightmost derivation of the following string. Num times num plus num times num $(c) Describe how this grammar structures expressions, in terms of the precedence and left- or righ- associativity of operators.

  6. 4.11: Compute First and Follow sets for the nonterminals of the following grammar.S  a S e | BB  b B e | CC  c C e | d

  7. Submission • Hand-written exercises: hand in your paper version in class • Due: two weeks (Nov. 15, 2011)

More Related