Due: Sunday, 5 May 2013 at 11:59pm
Source:
Download: project7.zip
To Submit: Go Here
This is a group project. Teams of size 1 or 2 are acceptable. If you are working in a team of two, only one student needs to submit the project. Be sure to fill in the team.txt file.
What to turn in:
Turn in a file called project7.zip. It should contain at minimum:- A set of OAT source files *.oat that implement an OAT program or library of your own choosing.
- Any additional files needed to compile and run your program on Eniac (e.g. any C files or non-standard libraries you need).
- A description of your OAT software in README.txt
- The team.txt file.
Overview
You've spent the semester implementing a compiler for the OAT language, but you haven't had much opportunity to actually use the language itself. This project, meant to be fun, is to write some OAT code.
Building/Running the Project
This project uses the same build configuration as in Projects 5 and 6, however the version of OAT that we have provided does not do any interesting optimizations, so the -OAsm -Oil and -OAst flags do nothing. We recommend that you use the --llvm-backend flag, which will use LLVM's -O2 level optimizations by default. If you would prefer to use the optimizing compiler that you wrote for Project 6, contact us.
Note that you will need to use the -lib flag as described below to pass extra arguments so that gcc can link against C libraries.
What to Do
We have provided a complete, working implementation of the (non-optimizing) OAT compiler. For this project, you don't need to make any modifications to the OAT compiler (but see the description of Extra Credit below). Instead, you will write a smallish OAT program or library of your choosing, subject to these constraints:
- Your library or program should be approximately 500 lines of well-structured OAT code. (To give you a sense of how much this is, the partial implementation of "space invaders" in tests/encroach.oat is about 375 lines of code, not including library code.)
- Your software should use some C library functionality.
We have provided lib/console.oat along with lib/console.c and lib/console.h as an example of how to wrap some C functions for use with OAT. You are welcome to use the console (it needs some version of the curses library) or wrap some other C library for use in OAT. Note that if you choose to use some other library, you will need to figure out a way to express the library's interface using OAT types -- this may not always be easy (or even directly possible). One approach is to have the C wrapper functions interface between the library types and the OAT types.
~/cis341/projects/project7.ll> ./main.native --llvm-backend -I lib -lib lib/console.c -lib -lcurses tests/encroach.oat -o encroach Configuring platform... [Mac OS] Processing: tests/encroach.oat root name: encroach * cpp -E -Ilib tests/encroach.oat c_obj/encroach.i.oat * gcc -mstackrealign -c -m32 -o c_obj/encroach.o c_obj/encroach.s * gcc -Wl,-no_pie -mstackrealign -m32 -o encroach c_obj/encroach.o soln/runtime.c -lcurses lib/console.c -Ilib
Here are some ideas for the kinds of programs/libraries you could try to implement:
- A simple game with console graphics (or, just complete encroach.oat)
- A simple graphics toolkit wrapping a subset of OpenGL or some other graphics library
- A more fully-featured string processing library
- An OAT library for doing disk IO and a simple program that exercises that functionality
- OAT bindings for (a subset of) SQLite and a simple program that uses the database
- An OAT implementation of a more sophisticated data structure (e.g. hash maps) and a simple test suite
We will test your code on Eniac. If the libraries you need are not availble by default, let us know where to find them or include them in your submission. If, for some reason, you really would like to use a library only available on a different platform (e.g. Windows of Mac) please contact the course staff and we will try to accomodate you.
Also, if your library requires substantial C coding to implement suitable OAT binders, you don't have to write as large of a program in OAT itself -- again, if you have questions about the suitability of your project idea, please contact one of the course staff.
Extra Credit
If you'd like a significant challenge and a chance for extra credit, you can modify the OAT language to support some new feature that is useful for the program/library that you implement. Depending on the modification, you might need to change all of the OAT files -- from the lexer and parser through the back end of the compiler, and potentially even the X86 subset. Some example extensions that you might consider include: support for floating point computations, anonymous tuple types (as in ML), new controls structures like break and continue, or enumerations and switch.If you choose to go this route, please contact one of the course staff to run your idea by us before you start.
Grading
Once again, this project does not have automated grading support. Also, this project is meant to be fun, so the grading will be largely ad-hoc. Your grade will be determined by:- Functional correctness of your program/library and meeting the minimal requirements described above: 70 pts.
- Subjective assessment of "coolness" of the project: 10 pts.
- Thoroughness of your writeup in README.txt: 10 pts.
- Coding Style: 10 pts. (try to write readable OAT, please!)
- Extra Credit: Up to 30 points, depending on the sophistication of the languag modification.