final_001

final_001 - CS 352 Compilers: Principles and Practice Final...

Info iconThis preview shows pages 1–4. 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

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: CS 352 Compilers: Principles and Practice Final Examination, 5/4/10 Instructions: Read carefully through the whole exam first and plan your time. Note the relative weight of each question and part (as a percentage of the score for the whole exam). The total points is 100 (your grade will be the percentage of your answers that are correct). This exam is closed book, closed notes . You may not refer to any book or other materials. You have two hours to complete all five (5) questions. Write your answers on this paper (use both sides if necessary). Name: Student Number: Signature: 1. (Compiler phases; 10%) The M3 compiler you worked on this semester manipulates several representations of a program as it is compiled. The initial input is a M3 source program. In the last project you were able to see the output from all the phases of the compiler. Describe the program representations (and any other compile-time data structures) that are generated as output from each of the following compiler phases: (a) scanning (lexical analysis) Answer: tokens (b) parsing (syntactic analysis) Answer: abstract syntax trees (ASTs) (c) type checking (semantic analysis) Answer: annotated ASTs, symbol tables (d) translation (synthesis) Answer: IR trees, frame layout (e) canonicalization (flattening of IR trees) Answer: IR statements (tuples) (f) instruction selection Answer: assembly language instructions (g) control flow analysis Answer: control flow graph (CFG) (h) data flow analysis (liveness) Answer: interference graph (i) register allocation Answer: colored interference graph (j) code generation Answer: assembly language 2 2. (Parsing; 30%) Consider the following simple grammar and the language it describes: S | a | ( S ) | ( S ; S ) Recall that an LL grammar can be parsed top-down where every derivation stop is predicted by lookahead (as needed). Recall also that an LR grammar can be parsed bottom-up where every reduction step is predicted by lookahead (as needed)....
View Full Document

Page1 / 8

final_001 - CS 352 Compilers: Principles and Practice Final...

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