quiz4-example-fall11

quiz4-example-fall11 - b. (8 pts) Write a predictive,...

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

CMSC330 Fall 2011 Example Quiz #4 Name Discussion Time (circle one): 10am 11am 12pm 1pm 2pm 3pm Do not start this exam until you are told to do so! Instructions You have 25 minutes for this quiz. This is a closed book exam. No notes or other aids are allowed. Answer essay questions concisely using 2-3 sentences. Longer answers are not necessary and a penalty may be applied. For partial credit, show all of your work and clearly indicate your answers. Write neatly. Credit cannot be given for illegible answers. 1. (14 pts) Parsing Consider the following grammar: S aA | A A bS | ca a. (6 pts) Compute First sets for S and A

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b. (8 pts) Write a predictive, recursive descent parser for the grammar 2. (16 pts) Lambda calculus Circle all free (unbound) variables in the following &amp;-expression a. (2 pts) ( &amp; a. a ( &amp; b. b a ) a b ) a Evaluate the following &amp;-expressions as much as possible. Show each beta-reduction b. (3 pts) ( &amp; x. &amp; y.y x) a ( &amp; z.z) b c. (3 pts) ( &amp; y. &amp; x x y) x a b d. (8 pts) Using encodings, show 3*1 =&gt;* 3. Show each beta-reduction. =&gt;* indicates 0 or more steps of beta-reduction 3*1 =&gt; M * N = &amp; x.(M (N x)) 1 = &amp; f. &amp; y.f y 2 = &amp; f. &amp; y.f (f y) 3 = &amp; f. &amp; y.f (f (f y)) 4 = &amp; f. &amp; y.f (f (f (f y)))...
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 330 taught by Professor Staff during the Fall '08 term at Maryland.

Page1 / 2

quiz4-example-fall11 - b. (8 pts) Write a predictive,...

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

View Full Document
Ask a homework question - tutors are online