#MiniJS-REPL-Scala
Loyola University Chicago
COMP 372 - Programming Languages
Spring 2015 - Project 3 MiniJS REPL in Scala
In this project, you will write a front end (lexical and syntax analysis combined as a PEG) for a Scala-based interpreter/REPL for the simple imperative language MiniC (you will work on the actual interpreter in project 3b and subsequent stages). Your recommended starting point is the expressions-scala example.
- Extend grammar to support MiniJS's imperative constructs (statements)
- Extend abstract syntax tree to support the imperative constructs
- Extend the parser to support the imperative constructs
- Extend the unparser (pretty-printer) to support the imperative constructs
In this project, you will continue your work from project 3a by implementing the dynamic language semantics of MiniJS as part of the evaluator/interpreter. (This was disabled for project 3a because it did not yet handle the imperative constructs). Use the simple imperative language example for additional guidance.
- Support dynamic semantics of the new imperative constructs (statements)
- Create mutable store to map named variables to storage cells where values can be stored
In this project, you will add proper data structures (product or aggregation types) to the MiniJS language by adding constructs for:
- structure creation
- field selection
- assignment to an existing field in a structure
- addition of a new field to a structure
To this end, we will extend both the grammar and the interpreter. You may refer to this structural operational semantics example for a simpler version of this language (without field addition).
- Changes to the grammar
- Additions to the AST and unparser
- Support in the interpreter
Note: If statements in our program do not work exactly like they do in the JavaScript console. The initial if statement contains an equals expr that returns a boolean indicating whether or not the left and right sides of the equals expr are in fact equal. Ex:
if(1+1=2){3;} else {4;}
returns 3, and
if(1+1=9){3;} else {4;}
returns 4.
Starting Point: A simple expression evaluator in Scala using parboiled2 for parsing.