Interpreter for the following language:
expr ::= expr op expr | atom | + atom | - atom
atom ::= (expr) | identifier | { expr, expr } | number | map(expr, identifier -> expr) | reduce(expr, expr, identifier identifier -> expr)
op ::= + | - | * | / | ^
stmt ::= var identifier = expr | out expr | print "string"
program ::= stmt | program stmt
How to build and run (using Maven)
cd
to the project foldermvn install
mvn exec:java
Interpreter requirements
- Interpreter should report parsing errors and mismatched types errors (adding number to a sequence, applying map/reduce to a number, etc).
- Support of calculations on long sequences (millions of elements)
- Map/reduce should be executed in parallel using rational execution strategy
UI requirements
- Program should be interpreted on the fly
- Time-consuming calculations should not block the UI and should be cancellable
- Errors from the interpreter should be shown in the editor
Dependencies
- ANTLR4 for lexer/parser
- RSyntaxTextArea for editor
- JUnit for tests