Docsity

Assignment 2 - Programming Language Concepts | COMP 524, Assignments of Programming Languages

Toggle sidebar
bg1
Comp 524—Spring 2007
Homework 2
Due at 3:30 PM, February 1, 2007.
1. (20 pts) Construct NFA, DFA, and Minimized DFAs for the following REs
a. 1*|0
b. (10|01)*1
c. (11|00)*(01|10)*
2. (15 pts) Solve question 2.1 in the book (pages 96-97): (a), (b), and (e)
3. (30 pts) Solve question 2.9 in the book (page 98)
4. (5 pts) Why is the following grammar ambiguous?
foo → AAA bar qux | DDD
qux → CCC foo | ε
bar → BBB foo
5. (10 pts) Why are the following not LL(1) grammars
a.
foo → AAA bar;
bar → bar BBB
bar → BBB
b.
foo → AAA bar
bar → BBB foo
bar → BBB qux
qux → CCC
6. (20 pts) Construct the FIRST, FOLLOW, and PREDICT tables for the grammar in
problem 2.13 (page 99). (Note: The last production is “Es→ εε”)

Partial preview of the text

Download Assignment 2 - Programming Language Concepts | COMP 524 and more Assignments Programming Languages in PDF only on Docsity!

Comp 524—Spring 2007

Homework 2

Due at 3:30 PM, February 1, 2007.

1. (20 pts) Construct NFA, DFA, and Minimized DFAs for the following REs a. 1| b. (10|01) c. (11|00)(01|10) 2. (15 pts) Solve question 2.1 in the book (pages 96-97): (a), (b), and (e) 3. (30 pts) Solve question 2.9 in the book (page 98) 4. (5 pts) Why is the following grammar ambiguous? foo → AAA bar qux | DDD qux → CCC foo | ε bar → BBB foo 5. (10 pts) Why are the following not LL(1) grammars a. foo → AAA bar; bar → bar BBB bar → BBB b. foo → AAA bar bar → BBB foo bar → BBB qux qux → CCC 6. (20 pts) Construct the FIRST, FOLLOW, and PREDICT tables for the grammar in problem 2.13 (page 99). (Note: The last production is “Es→ ε ”)