The software you are developing for CSE 450 is focused on compilation, but the core ideas behind interpreting a source program remains identical -- you still have to lex and parse the input, do semantic checking on it, convert it to an Abstract Syntax Tree. But instead of converting the tree to an Intermediate Code (like LMAOcode) and then to a Target Language (like ROFLcode), the other option is to just execute it directly.
For this honors project, you will modify your compiler to be an interpreter. This interpreter should be able to handle all of the features that you implemented in Projects 1 through 4. However, no tests will involve GIMMEH or WHATEVR.
The honors project is a Mimir project with the same name.
Your project.py file must have a function called "generate_output_from_LOLcode" which takes a LOLcode string and returns the output from running it.
In order to receive Honors Credit, you must pass every test in Project Honors. There is no partial credit.
I recommend that you implement this option by creating an interpret() method to parallel your compile() method throughout the abstract syntax tree node implementations. Note that interpret() will still return a symbol_table.Entry, but it does not need to have access to the compiled_code since it won't use it.
This project should include very few (or no) changes to your lexer and parser. Most of the changes will be in how you traverse the AST and how the symbol table is implemented.
One of the biggest differences between your interpreter and your compiler is how the symbol table is structured. In a compiler, the table will reference a register location for the virtual machine. An interpreter reads and executes the source directly, which means it will need to keep track of and store variables' values.
To be more specific, the table is a dictionary, so it consists of a string "key", and a value. The type of the value for an interpreter can be one of the 3 primitive types.
For the purposes of this project, the type of a variable will not change after it is declared. At this point, your compiler probably keeps track of types already. This means you can check the type of a variable.
Note, this form of type system is known as static typing. It is more common in compiled languages. C/C++, Java, and Go are examples of this.
You need to solve this project by creating an interpreter, not compiling then executing the compiled code. Your solution should not involve the provided interpreter.py (which interprets LMAOcode and ROFLcode). No LMAOcode or ROFLcode should be involved in your solution in any way, and submiting a project that violates this rule consitutes academic dishonesty. Please check if you are uncertain about if your solution violates this rule.