Assignments

Assignment 5 - polished compiler

This is basically your chance to polish everything properly. There are no new requirements for this, just that you finish and integrate all of your work.

Due: Friday April 15th, 9am. This is a very hard deadline, as grades need to be handed in.

Assignments 3/4 - code generation to LLVM

The code generation phase will be split up into 2 assignments (for handing-in purposes). The assignments will be marked and have a deadline (so you get some feedback), but you will be assumed to have completed ≥ 75% of the assignment, not necessarily 100%.

The details for assignment 3 are below those for assignment 4 below.

Assignment 4 - code generation part II

due: Friday April 8th (through Avenue).[there will be no extensions]

Goal: Generate (LLVM) code for your whole language.

Steps:

Using the appropriate bindings to LLVM for your language, generate code for everything 'else' in your language. This includes (if relevant) classes, exceptions, etc.

Deliverables: You need to deliver:

  1. A 'log' (preferably in HTML, but .pdf is ok too) which explains:
  2. Your 'code', as a .zip or .tgz file (no .rar please!). The code should include a set of tests (both correct and incorrect inputs in your chosen language) as well as a test harness that executes these tests. These can be a mixture of unit tests (which test only the new parts) and system tests (which test your whole system).
  3. Do NOT include executables, object files or version-control-system files in this bundle. If your bundle is larger than 100K, you definitely have unecessary junk in there.

Grading: 80% will be on the code and tests, 20% on the log. The code will be graded for elegance and readability as well as correctness; the tests will be evaluated for their coverage. The log will also be graded for 'usefulness' (i.e. to the TA) as well as appropriate citation of the source material.

Assignment 3 - code generation part I

due: Friday March 25th (through Avenue).

Goal: Generate (LLVM) code for expressions and functions.

Steps:

Using the appropriate bindings to LLVM for your language, generate code for the simple expressions, and functions (methods) of your language. [You may restrict to first-order functions]. Include the implementation of all basic data-types (and functions on them), arrays, mutable variables.

Deliverables: You need to deliver:

  1. A 'log' (preferably in HTML, but .pdf is ok too) which explains:
  2. Your 'code', as a .zip or .tgz file (no .rar please!). The code should include a set of tests (both correct and incorrect inputs in your chosen language) as well as a test harness that executes these tests. These can be a mixture of unit tests (which test only the new parts) and system tests (which test your whole system).
  3. Do NOT include executables, object files or version-control-system files in this bundle. If your bundle is larger than 100K, you definitely have unecessary junk in there.

Grading: 80% will be on the code and tests, 20% on the log. The code will be graded for elegance and readability as well as correctness; the tests will be evaluated for their coverage. The log will also be graded for 'usefulness' (i.e. to the TA) as well as appropriate citation of the source material.

Assignment 2 - typing and symbol table

due: Friday March 4th (through Avenue).

Goal: Learn about symbol tables and type systems.

Steps:

Building on Assignment 1, you now have to add a type system to your compiler. Part of this will require you to also build symbol table(s) for your AST. Note that it is generally a good idea to do a transformation from your parse tree to a more abstract AST (although in certain languages, this can be done by the parser itself).

Deliverables: You need to deliver:

  1. A 'log' (preferably in HTML, but .pdf is ok too) which explains:
  2. Your 'code', as a .zip or .tgz file (no .rar please!). The code should include a set of tests (both correct and incorrect inputs in your chosen language) as well as a test harness that executes these tests. These can be a mixture of unit tests (which test only the new parts) and system tests (which test your whole system).
  3. Do NOT include executables, object files or version-control-system files in this bundle. If your bundle is larger than 100K, you definitely have unecessary junk in there.

Grading: 60% will be on the code and tests, 40% on the log ( with most of the marks on the description of the type system). The code will be graded for elegance and readability as well as correctness; the tests will be evaluated for their coverage. The log will also be graded for 'usefulness' (i.e. to the TA) as well as appropriate citation of the source material.

CS 6TB3: for those taking the graduate version of this course, this assignment will cover all of the above, and you should also give some informal arguments as to why you believe that your type system and your operational semantics 'match'.

Bonus: Extra marks will be awarded for giving a formal operational semantics for your language. Many further marks for providing a proof of safety of your type system with respect to your operational semantics. If this proof is mechanized, unless you fail the final, you'll essentially be guaranteed an A+.

Assignment 1 - parsing

due: Friday February 18th (through Avenue).

Goal: Learn to use parsers generators.

Steps:

  1. Pick a language to compile. Here are some choices: You may also choose your own - but you need to check with me (by Friday Feb. 4th) if your choice is reasonable.

  2. Pick an implementation language. Make sure to pick a language which has some good support for compilation activities (such as useful libraries and parser generators and/or combinators).
  3. Implement a parser (using a generator or combinator library) for your language of choice

Deliverables: You need to deliver:

  1. A 'log' (preferably in HTML, but .pdf is ok too) which explains:
  2. Your 'code', as a .zip or .tgz file (no .rar please!). The code should include a set of tests (both correct and incorrect inputs in your chosen language) as well as a test harness that executes these tests. Do NOT include executables, object files or version-control-system files in this bundle. If your bundle is larger than 100K, you definitely have unecessary junk in there.

Grading: 70% will be on the code and tests, 30% on the log. The code will be graded for elegance and readability as well as correctness; the tests will be evaluated for their coverage. The log will be graded for 'usefulness' (i.e. to the TA) as well as appropriate citation of the source material.

CS 6TB3: for those taking the graduate version of this course, this assignment will be 'the same', except that you will be expected to provide more automation (building, tests, etc) and coverage.

Bonus: Extra marks will be awarded for parsers which generate good error messages when syntax errors are encountered. Additional marks will also be given for good 'error recovery', i.e. parsers which can correctly parse 'good' code which comes after an error.