To receive credit at the graduate level, two additional assignments are required.
Write a paper comparing and contrasting two languages from the perspective
of a compiler writer. Summarize the grammar, type system, and semantics
of each language, illustrating with some simple code examples. Describe
how these aspects of the language would affect the design of a compiler,
as if you were setting out to write a compiler similar to the class project.
Take a little time to pick two langauges that are interesting, well documented,
and have significantly different features. At least one of the languages should have been invented after the year 2000, and at least one of the languages should have a arguably strict type system. Before starting your paper, email Prof. Thain with your chosen languages for approval.
I'm more interesting in your writing than in the formatting of the paper,
so just keep it simple: use 12 point font and one inch margins on plain paper.
You are welcome to use a different font/style for code examples, but don't
spend a lot of effort on formatting.
Naturally, you will need to look up some reference material to gather
information for the paper. You should include a Bibliography section
that lists any books, web sites, papers, etc that were consulted.
Of course, all of the writing in the paper should be yours alone,
based on the understanding gained from references. If you find it necessary
to include words written by others, be sure to clearly quote and reference them. However, those should be a very small fraction of the paper, if used at all.
This paper is due at 5PM on Monday, October 28th.
Please turn in a printed copy to my mailbox in the CSE office.
As usual, late assignments are not accepted.
Improve the code generation stage of your compiler in a substantial way.
Here are some ideas to get you thinking; you are welcome to modify or
extend these in some way:
Implement bounds-checked arrays that can be used through a B-minor program, not just at global scope. This requires careful modifications to stack management, more sophisticated address computations, and run-time checking of array limits.
Add a second backend to your compiler that emits a portable intermediate language (such as LLVM or WebAssembly) or a different assembly language (such as MIPS or ARM) and test it in an appropriate virtual machine or execution environment.
Implement type specializiation by allowing function arguments to have the auto type.
Infer the type(s) actually used by the program, and then emit code specialized to each type as needed.
(Similar to template functions in C++.)
Implement several optimizations that dramatically improve the output of your compiler (such as tree-based code generation) and critically compare the output to the original.
Plan ahead: whatever extension you choose will require effort throughout the second half of the semester.
Get the regular code generator done well before the deadline, so you can move on to the improvement.
Your final submission should include a README that carefully explains the objective of the extension,
how it was implemented, and how to invoke and test the extension.