A toy interpreter for a toy version of ABAP.
- Clone the repo.
- Run
CLASSPATH=path/to/your/antlr-4.8-complete.jar make prepare
(the Makefile has `/usr/share/java/antlr-4.8-comple.har as a default path). - Run the project as
node index.js
or event./index.js
!
node index.js --source <sourceFile> [--input <inputFile>]
Input defaults to stdin.
- task.md: The task in hand.
- ABAP.g4: ANTLR grammar for the project
- index.js: Entrypoint for the interpreter. Contains the setup of the parser and the handling of the arguments.
- ChecksVisitor.js: A ParseTreeVisitor that transforms a parse tree into a (maybe empty) list of errors.
- CompilerVisitor.js: A ParseTreeVisitor that transforms a parse tree into an anonymous function that interprets the program.
- test: Small "test-suite"
- example*.abap: An example file
- example*.input: The input to test that example file
- example*.output: The expected output
Note: the Makefile uses GNU Make syntax. If you use Windows or BSD flavors of make it will not work.
- tree-% and gui-%: Run antlr's grun and see the parse tree of test/example%.abap
- test-%: Run the interpeter on test/example&.abap with test/example%.input as input and compare the results against test/example%.output.
- prepare: Generates the javascript parser files.
- clean: Remove all the files generated by antlr.