quiz4-fall11

quiz4-fall11 - match function for terminals that will...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC330 Fall 2011 Quiz #4 Name Discussion Time (circle one): 9am 10am 11am 12pm 1pm 2pm Instructions You have 20 minutes for this quiz. This is a closed book exam. No notes or other aids are allowed. For partial credit, show all of your work and clearly indicate your answers. Write neatly. Credit cannot be given for illegible answers. 1. (6 pts) First Sets Calculate the FIRST set for S, A, and B in the following grammar: S Adg | Bh A aBc | epsilon B f | g
Background image of page 1

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

View Full DocumentRight Arrow Icon
2. (10 pts) Parsing Write a predictive, recursive descent parser for the following grammar. You may assume the existence of a
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: match ( ) function for terminals that will update the value for the lookahead token. S & bAb | c A & ad | epsilon 3. (6 pts) Lambda calculus Evaluate the following &-expressions as much as possible. Show each beta-reduction a. (1 pt) ( & x.y) z b. (1 pt) ( & x. & y.x y) a b c. (2 pts) ( & x.x x) ( & z.z) a b d. (2 pts) ( & x. & y.x) y a b 4. (8 pts) Lambda calculus encodings a. Using encodings, show 1*1 =>* 1. Show each beta-reduction. =>* indicates 0 or more steps of beta-reduction M * N = & x.(M (N x)) 1 = & f. & y.f y 2 = & f. & y.f (f y) 3 = & f. & y.f (f (f y)) 4 = & f. & 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 / 4

quiz4-fall11 - match function for terminals that will...

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

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