A9: JoCalf


A baby camel is called a calf. In this assignment you will implement an interpreter for JoCalf, a young language whose parents are OCaml and JavaScript. She also has a little bit of DNA from Racket, an untyped functional language descended from Lisp and Scheme.

The JoCalf manual contains a brief tutorial on the features of JoCalf, followed by a description of each language feature in detail. The formal semantics gives a precise, mathematical description of the language using a big-step environment model. In CMS, you can download a pre-compiled reference implementation of the interpreter that will run on the 3110 VM (but not other operating systems); it’s the file named jocalf in the A9 assignment.

Parsing and lexing has already been implemented for you in the starter code, as has a read-evaluate-print loop (REPL). You will implement an evaluator based on the formal semantics.

Table of contents:

Step 1: Team Maintenance

You will do this assignment with the same team as the midterm project.

Before the team meeting, every team member should print out and fill out an Internal Evaluation for all other team members. These are meant to be anonymous, and to provide advice to team members on how they are fulfilling their teamwork obligations, as well as how to improve. At the end of the meeting, distribute the evaluations. Each team member should shuffle the papers they receive, so as to maintain anonymity. Team members should review the evaluations on their own after the meeting.

After this assignment is due, you will submit a performance evaluation of your teammates (covering A6 through A9) to the professor, and those evaluations will become part of team members’ grades.

Step 2: Explore the Starter Code

There is a makefile provided with the usual targets: build, test, check, finalcheck, zip, docs, and clean. There is a new target, make repl, that will build the JoCalf REPL and run it.

We are back to an autograded assignment, hence your submission must pass make check. As always, if you’re ever in doubt about whether a change is permitted or not, just run make check: it will tell you whether you have changed the interface in a prohibited way.

Here is a guided tour of the files in the starter code:

Step 3: Evaluation

Implement evaluation by completing ast.ml, ast_factory.ml, and eval.ml. Here is an algorithm for how to do that:

Note that this algorithm is highly parallelizable among team members. But you will be editing the same definitions in the same files, so you must be meticulous in your use of Git to avoid conflicts or clobbering code written by other team members.


Coding Standards

We will not assess coding standards on this assignment. We trust that you will use what you have learned in the rest of the semester to your advantage.


Make sure your team’s NetIDs are in authors.mli, and set the hours_worked variable at the end of authors.ml.

Run make zip to construct the ZIP file you need to submit on CMS. Any mal-constructed ZIP files will receive a penalty of 20 points. The size of the the files is limited in CMS to 1 MB. Please stay within the size allotted.

Submit your zipfile on CMS. Double-check before the deadline that you have submitted the intended version of your file.

Congratulations! Your new-born calf snuggles with you.

Acknowledgment: JoCalf was inspired by the paper The Essence of JavaScript, by Arjun Guha, Claudiu Saftoiu, and Shriram Krishamurthi, corrected version of October 3, 2015. Prof. Guha was a postdoc at Cornell approx. 2013, supervised by Prof. Foster.