CSE340Fall2009FinalExam

CSE340Fall2009FinalExam - Arizona State University Ira A....

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 Fall 2009 FINAL EXAM State any assumptions you make. TOTAL ________ 84 Write legibly . If I cannot read what you write, I cannot grade it! Question0. [1 point] Write your name! Question 1. [6 points] Consider the following EBNF grammar. P ( P ) P ( P ) P P ( ) P P → ( ) 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 DocumentRight 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 P ( P ) P P P P → ( ) Draw a parse tree for the string (())(). Show that the grammar is ambiguous.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Question 4. [6 points]
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.

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 / 11

CSE340Fall2009FinalExam - Arizona State University Ira A....

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