Grades and deadlines
-
Initial deadline: 23:59 on Thursday 12 November
-
How to submit: Turn in your completed
lab4.2.ymlfile, along with everything in thesrc/mainfolder of your maven project.You must submit via the command line in order to preserve the folder structure. Use either of these two commands to do it:
club -csi413 -plab4.2 -f lab4.2.yml src/main aichat.mdor
submit -c=si413 -p=lab4.2 lab4.2.yml src/main aichat.md(you can download the club tool here)
-
Collaboration and AI: Recall the course policy on collaboration and AI usage. For this lab:
-
You can collaborate with freely with any classmate who is working on a different language from you, as long as that is cited and you do your own work.
-
You may use the class Gemini Gem as long as you cite where/how you used it and you turn in a complete transcript of all relevant conversations.
-
You may not use other AI tools besides the course-specific Gemini Gem. If you think there is something useful that you aren’t able to do with the Gem, talk to your instructor!
-
-
Grading:
In this lab you will complete the following tasks:
- Write a complete, working interpreter for one of the selected language, supporting closures and lexical scope.
- Thoroughly test your interpreter on the included programs as well as new, simpler programs that you write
If your submission meets the requirements for each task, you will receive 10 points towards your total lab grade.
-
Resubmissions:
We will follow the same resubmission policy for all labs this semester. For any given deadline you must at leat demonstrate significant progress or you get a zero that cannot be revised. The initial deadline for this lab is the same regardless of any other pending resubmissions on previous labs. If your work is not yet up to the standard, you will receive a new deadline of one week later (up to the end of the semester) and a chance to revise for full credit.
The languages
Each chosen language has a separate github repo with starter code:
Once you have chosen your language, you can clone the repo like this:
git clone https://github.com/si413usna/startlab.git -b lab4.2-XXXXXX lab4.2
replacing XXXXXX with hibana, digest, or void.
Your task
For each chosen language, the starter code contains a partially working interpreter, which is able to handle mostly the Unit 3 stuff like variables, string and boolean operations, if statements, and while loops, with a single global scope.
In this lab, you will first need to understand the new language you are
working with. The best way to do that is to look at the example
programs, as well as the language syntax spec in tokenSpec.txt and
ParseRules.g4.
Then, you will need to add to the existing functionality to support function calls with closures and lexical scope, similar to the Scheme and Python examples we have seen in class. In particular, you will want to add:
- Some AST node(s) for function definitions (or lambdas)
- Some AST node(s) for function calls
- New visit methods in
ASTGento connect the parse tree to those new AST nodes - Support in the dynamically-typed
Valueclass for a Closures, which should combine a Frame (referencing environment) with the function or code to execute. - Support in the
Frameclass (as well asInterpreter.java) for parent frames and lexical scoping logic
This list is in no particular order, and in fact many of these tasks are kind of inter-related. Part of your challenge is to figure out how to work methodically and carefully, testing as you go, to build this magnificent piece of software.
This is the pinnacle of what we are asking you to do in this course. Your hard work so far has led you here, and we know you are ready for it. Good luck and have fun with it!