You may do this assignment in OCaml, Python or Ruby. You must use each language at least once (over the course of PA2 - PA5); you will use one language (presumably your favorite) twice.
You may work in a team of two people for this assignment. You may work in a team for any or all subsequent programming assignments. You do not need to keep the same teammate. The course staff are not responsible for finding you a willing teammate. However, you must still satisfy the language breadth requirement (i.e., you must be graded on at least one OCaml program, at least one Ruby program, and at least one Python program).
You will also write additional code to unserialize the class and implementation maps produced by the semantic analyzer and the parse tree produced by the parser.
class Main inherits IO { my_void_io : IO ; -- no initializer => void value main() : Object { my_void_io.out_string("Hello, world.\n") } ; } ;
Example error report output:
ERROR: 4: Exception: dispatch on void
You can do basic testing as follows:
$ cool --type file.cl $ cool file.cl >& reference-output $ my-interp file.cl-ast >& my-output $ diff my-output reference-output
Note that this time, whitespace and newlines matter for normal output. This is because you are specifically being asked to implement IO and substring functions.
You should implement all of the operational semantics rules in the Reference Manual. You will also have to implement all of the built-in functions on the five Basic Classes.
For the PA5c checkpoint you will only be tested on hello-world.cl. If you can interpret that, you pass the checkpoint. (You can "cheat" the checkpoint by hard-coding output for that single test case, but you're ultimately only hurting yourself!)
You must turn in a zip file containing these files:
Students on a team are expected to participate equally in the effort and to be thoroughly familiar with all aspects of the joint work. Both members bear full responsibility for the completion of assignments. Partners turn in one solution for each programming assignment; each member receives the same grade for the assignment. If a partnership is not going well, the teaching assistants will help to negotiate new partnerships. Teams may not be dissolved in the middle of an assignment.
If you are working in a team, exactly one team member should submit a PA5 zipfile. That submission should include the file team.txt, a one-line flat ASCII text file that contains exactly and only the email address of your teammate. Don't include the @virgnia.edu bit. Example: If ph4u and wrw6y are working together, ph4u would submit ph4u-pa5.zip with a team.txt file that contains the word wrw6y. Then ph4u and wrw6y will both receive the same grade for that submission.
In each case we will then compare your output to the correct answer:
Note that this time we do not ignore newlines and whitespace since
we are explicitly testing your implementation of a string IO subsystem. You
must get every character correct in non-error instances.
If your answer is not the same as the reference answer you get 0
points for that testcase. Otherwise you get 1 point for that testcase.
For error messages and negative testcases we will compare your output but not the particular error message. Basically, your interpreter need only correctly identify that there is an error on line X. You do not have to faithfully duplicate our English error messages. Many people choose to (because it makes testing easier) -- but it's not required.
We will perform the autograding on some unspecified test system. It is likely to be Solaris/UltraSPARC, Cygwin/x86 or Linux/x86. However, your submissions must officialy be platform-independent (not that hard with a scripting language). You cannot depend on running on any particular platform.
There is more to your grade than autograder results. See the Programming Assignment page for a point breakdown.
Python's division truncation works differently from C's. This is more than a little annoying, and certainly a "gotcha".
I seem to have solved the problem by adding
from __future__ import divisionto the top of my file, which makes the / operator always return a floating-point result, then casting the result of a/b to an integer via the int() constructor.