Femto C
November 21th, 2011
Background
For this weeks lab you will be writing a Femto C interpreter. The Femto C interpreter only handles integers, array references/assignments and variable assignments.
To get started, download the skeleton code and the FemtoCore. Open the skeleton code and add the FemtoCore as an external jar. Your code should build at this point. You should be able to run the main method in FemtoCCLI. Take note that it doesn't do much at this point.
The Assignment
In the two packages AST and VM there is skeleton code for you to fill out. Every place you need to fill in code is marked with a //TODO. Carefully look over the interfaces VM.java and ASTCell.java for functionality hints.
How it should work
After you have finished, you should be apble to assign values to variables and arrays. You should also be able to look up values.
Example:
in> a = 5
:- (store a 5)
out> 5
in> a[1] = 2
:- (store (aref a 1) 2)
out> 2
in> a
:- a
out> 5
in> a[2]
:- (aref a 2)
in> xxx core.ReferenceException: Unrecognized variable reference: 'a[2]'
a[1]
:- (aref a 1)
out> 2
The code to download
Grading
For full credit, turn in a jar file containing the fleshed out skeleton code.