COP5621exam1 - COP5621 Compiler Construction Exam 1 -...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 6

COP5621exam1 - COP5621 Compiler Construction Exam 1 -...

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

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