]
>
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
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. | | | |
- Provide a leftmost and a rightmost derivation for a string in the
language
- Provide a pushdown automaton that simulates the leftmost
derivations for the given grammar.
- 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. | | | |
- Use the string ‘b b a c a’ to show that the grammar defines an
ambiguous language
- Show the FIRST(1) and FOLLOW(1) functions for the nonterminal
symbols.
- Construct the LL(1) parse table for .
Some cells in the table may contain multiple entries.