{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework6-sol - COP 5555 Programming Language Principles...

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

View Full Document Right Arrow Icon
COP 5555 Programming Language Principles Homework 6 - Solution Assigned: July 6, 2011 Deadline: 11:59pm July. 13, 2011 1. Problem 1 (20 Points) Give an example of a left associative operator in RPAL and then modify the grammar such that it won't be left or right associative anymore. Solution: An example is 'or' operator: B -> Bt ('or' Bt)+ (as done for 'tau' operator.) 2. Problem 2 (20 Points) According to the semantic definition of RPAL, are RPAL programs meant to be evaluated in PL order or normal order? Why was this choice made? Solution: Normal order for its better computation time. 3. Problem 3 (20 Points) Can you give an example of an RPAL program whose root of a fully standardized tree is not lambda or gamma? Can you give an example of an RPAL program in which Ystar is not a leaf in its standardized tree? (If it exists in both cases) Solution: Answer to the first part: A program with just the number “3” Answer to the second part: no
Background image of page 1

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

View Full Document Right Arrow Icon
4. Problem 4 (20 Points) Can you write a macro in standard C that `returns' the greatest common divisor of a pair of
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}