CSE340Fall2009Test1

# CSE340Fall2009Test1 - Arizona State University Ira A Fulton...

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

Arizona State University Ira A. Fulton College of Engineering Computer Science and Engineering CSE 340 Spring 2009 TEST 1 THIS TEST IS CLOSED BOOK AND CLOSED NOTES. Write legibly . If I cannot read what you write, I cannot give you credit! State any assumptions you make. Question0. Write your name! Question 1. [15points] 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). 2. Have your parser calculate recursively the number of 1 s in the input.

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

View Full Document
Question 2. [15 points] Consider the following program int a,b; 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; b = q(); Print(“%d”, b ); } Assume that dynamic scoping is in use.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

CSE340Fall2009Test1 - Arizona State University Ira A Fulton...

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

View Full Document
Ask a homework question - tutors are online