exam1sol

exam1sol - ECE 468/573 Midterm 1 September 30, 2011 Name: _...

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

View Full Document Right Arrow Icon
ECE 468/573 — Midterm 1 September 30, 2011 Name: ______________________________________ Purdue email: ______________________________________ Please sign the following: I afFrm that the answers given on this test are mine and mine alone. I did not receive help from any person or material (other than those explicitly allowed). X ___________________________________________ Part Points Score 1 10 2 15 3 15 4 25 5 35 6 20 Total 120
Background image of page 1

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

View Full DocumentRight Arrow Icon
1) You are writing a compiler that can produce two different kinds of code: x86 assembly code or Java bytecode (which will run on any Java Virtual Machine), and the user can select which type of code she wants at compile time. Give a scenario where she would choose to generate assembly code (i.e., give a scenario where generating assembly code would be better than producing byecode). Assume that a JVM is available on her target machine. (4 points). I would rather generate assembly when it takes a long time to compile for a particular target architecture, or when the program is complex and may take a long time to compile 2) Give a scenario where the programmer would choose to produce bytecode instead of assembly. Assume the target machine has an x86 architecture. (4 points). If the Fnal program is meant to be run on many architectures, or if the behavior of the program is very different for different inputs (so I may want to optimize it differently), I would prefer to generate bytecode. 3) To produce this kind of compiler, name the compiler passes that are common for both the x86 and the bytecode versions. (2 points). Common passes: scanner, lexer, semantic actions. Code generation and some of the
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.

This note was uploaded on 02/19/2012 for the course ECE 468 taught by Professor Test during the Fall '08 term at Purdue.

Page1 / 8

exam1sol - ECE 468/573 Midterm 1 September 30, 2011 Name: _...

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