CSE340Fall2008Test1

CSE340Fall2008Test1 - Arizona State University Fulton...

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

Arizona State University Fulton College of Engineering Computer Science and Engineering CSE 340 Spring 2008 State any assumptions you make. Write legibly. If I cannot read what you write, I cannot grade it! Question 1. [15 points] Consider the following EBNF grammar. E T + E | T T 0 | 1 | | 9 1. Write a recursive descent parser for this grammar. Pseudecode is OK. You can assume that your input consists of one expression terminated with a newline character. 2. Add code to your parser so that it outputs the number of times the digit 4 appears in the expression. To get credit for this part, you should code it recursively.

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

View Full Document
Question 2. [20 points] Consider the following program int a, b; int p() { int a, p; /* point 2 */ a = 3; p = a+ b; return p; } int q() { int b, q; /* point 1 */ b = 4; q = a+b+p; /* this last p is a function call */ return q; } Void main() { a = 1; b = 2; Print( %d , q); /* the q is a function call */ } Assume that dynamic scoping is in use. Draw the symbol table at point 1 and point 2 using the nested
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/27/2011 for the course CSE 340 taught by Professor Farley,t during the Fall '08 term at ASU.

Page1 / 7

CSE340Fall2008Test1 - Arizona State University 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