] > midterm exam

exit midterm exam

NAME¯

 
CSE 756: Mid Term Exam
 
Tu, April 29, 1:30—2:48
Open Notes, Open Books
The exam consists of three¯ problems
Answers not appearing in designated spaces WILL NOT be graded

Problem #1 (10 points)
Write a table-driven scanner for the language defined by the following grammar.
1. <command> <command> <command>
2. DO <parms> <command>
3. <op> <parms>
4. <parms> ( <integer>,<integer> )
5. <op> LINE
6. MOVE

Problem #2 (10 points)
Consider the following grammar.
1. S CA
2. A aA
3. a
4. C b
5. bC
  1. Provide a leftmost and a rightmost derivation for a string in the language
  2. Provide a pushdown automaton that simulates the leftmost derivations for the given grammar.
  3. Provide a (deterministic) recursive descend program for recognizing the strings in the language

Problem #3 (10 points)
Consider the following grammar.
1. S a
2. bSC
3. C cS
4. ϵ
  1. Use the string ‘b b a c a’ to show that the grammar defines an ambiguous language
  2. Show the FIRST(1) and FOLLOW(1) functions for the nonterminal symbols.
  3. Construct the LL(1) parse table for Lx. Some cells in the table may contain multiple entries.