This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: COP5621 Compiler Construction Exam 1 - Spring 2007 Name: (Please print) Put the answers on these sheets. Use additional sheets when necessary. You can collect 100 points in total for this exam. 1. Why are “forward declarations” needed in Pascal programs (or similarly, when do we require function prototypes in C)? ( mark one ) (4 points) (a) Programmers often make mistakes, so redundant declarations are useful to detect typ- ing errors early. (b) Pascal and C are designed for single-pass compilers. (c) The compiler makes multiple passes over the input to check all declarations, including forward declarations. (d) To make the programming language strongly typed. 2. Which one of the following identities on REs is correct ? ( mark one ) (4 points) (a) a(a|b| ) = (aa|ab) (b) ((a| )b) * = (a|b) * (c) (a * b * ) * = (a|b) * (d) ab * = abb * 3. Convert the following infix expression to postfix . You may assume the standard precedence and associativity of the operators is used. (4 points) (a+b) * c-d/e 1 4. There is a serious problem with the following Lex specification:4....
View Full Document
This document was uploaded on 12/04/2011.
- Fall '09