FinalCSE340

FinalCSE340 - Arizona State University Ira A Fulton College...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Arizona State University Ira A. Fulton College of Engineering Computer Science and Engineering CSE 340 Spring 2008 FINAL EXAM State any assumptions you make. Write legibly . If I cannot read what you write, I cannot grade it! Question0. [3 points] Write your name! Question 1. [6 points] Consider the following EBNF grammar. EL EL; E EL E E → T + E E T T → 0 T → 1 1. Write a recursive descent parser for this grammar. Pseudecode is OK. You can assume that your input is terminated with an EOF character (end of file).
Background image of page 1

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

View Full Document Right Arrow Icon
Question 2. [6 points] Consider the following program int a; int p() { /* point 1 */ a = 2; return a; } int q() { int a, q; a = 3; q = p(); q = q+a; return q; } Void main() { a = 2; Print(“%d”, q ()); } Assume that dynamic scoping is in use. 1. On the diagram below, fill in the blanks and specify parent scope of every function and current scope at execution point 1. 2. What value is printed by this program? a b main p q
Background image of page 2
Question 3. [ 7 points] Consider the following BNF grammar E E T E @ T T T F T → F F → 0 | 1 Draw a parse tree for the string &&@111
Background image of page 3

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

View Full Document Right Arrow Icon
Question 4. [6 points] Consider the following declarations
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 12

FinalCSE340 - Arizona State University Ira A Fulton College...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online