CSE340Fall2009Test1

CSE340Fall2009Test1 - Arizona State University Ira A....

Info iconThis preview shows pages 1–3. 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 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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

CSE340Fall2009Test1 - Arizona State University Ira A....

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

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