Homework 1

This is the archived website of SI 413 from the Fall 2012 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

1 Comparing and Contrasting Languages

List the programming languages you have used in the past, and for each one name some distinguishing characteristics. Think about why anyone would choose one language over another. What features does it have? What niche does it fill?

2 Symbol Table

What role does the symbol table play in compliation? What information is stored in it?

3 Reversible Compilation?

For each of these main steps in the compilation process, explain whether that step is always reversible. For example, the scanning phase reads in source code and produces a token stream. Is it always possible to reverse this process and produce the original source code from the token stream? Briefly explain why or why not.

  1. Scanning (source code to token stream)
  2. Parsing (token stream to parse tree)
  3. Semantic analysis (parse tree to abstract syntax tree)
  4. Code generation (AST to machine code)

4 Errors

Give an example of Java code that generates each of the following kinds of errors:

  1. Syntax error detected by the scanner
  2. Syntax error detected by the parser
  3. Static semantic error, detected at compile time
  4. Dynamic semantic error, detected at run tme