Computer Science 164 - Spring 1999 - Hilfinger - Midterm 1

# Computer Science 164 - Spring 1999 - Hilfinger - Midterm 1...

This preview shows pages 1–2. Sign up to view the full content.

CS164, Spring 1999, MT1 UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Science Computer Science Division CS164 Paul Hilfinger Spring 1999 You have two hours to complete this test. Please put your login on each sheet, kas indicated, in case pages get separated. Answer all questions in the space provided on the exam paper. Show all wor (but be sure to indicate your answers celarly.) The exam is worth a total of 35+ points (out of a total of 200) distributed as indicated on the individual questions. You may use any notes, book, or computers you please -- anything inanimate. We suggest that you read all questions before trying to answer any of them and work first on those about which you feel most confident. Problem #1 [9 points] A certain language has the following terminal symbols: @ ># i -| (the -| symbol is an end-of-file). A shift reduce parser for this language processes the strin @ i >i # @ i -| and performs the following actions: 1. Shift @. Then shift i 2. Reduce 0 symbols (from the stack), producing (the non-terminal symbol) N. Then reduce 2 symbols, producing E 3. Shift >. Then shift i. Then shift #. 4. Reduce 1 symbol. producing N. Then reduce 2 symbols. Producing E 5. Shift @. Then shift i 6. Reduce 0 symbols, producing N. Then reduce 2 symbols, producing E. Then reduce 3 symbols producing E. Then reuce 4 symbols, producing E 7. Shift -|. accepting the string. (When we say "reduce n symbols" above we mean n terminal and nonterminal symbols, not states. For file:///C|/Documents%20and%20Settings/Jason%20Rafte. ..Spring%201999%20-%20Hilfinger%20-%20Midterm%201.htm (1 of 5)1/27/2007 5:32:57 PM

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Computer Science 164 - Spring 1999 - Hilfinger - Midterm 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online