exam1-2007

exam1-2007 - COP5621 Compiler Construction Exam 1 Spring...

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

View Full Document Right Arrow Icon
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 inFx expression to postFx . You may assume the standard precedence and associativity of the operators is used. (4 points) (a+b) * c-d/e 1
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. There is a serious problem with the following Lex speciFcation:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 1

exam1-2007 - COP5621 Compiler Construction Exam 1 Spring...

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