Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— 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 | B B  b B e | C C  c C e | d

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


Download ppt "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."

Similar presentations


Ads by Google