Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iglosiggio/antlr-experiment
https://github.com/iglosiggio/antlr-experiment
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/iglosiggio/antlr-experiment
- Owner: iglosiggio
- Created: 2020-03-09T18:56:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-03-10T19:41:07.000Z (over 4 years ago)
- Last Synced: 2024-10-03T20:21:26.455Z (about 1 month ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# antlr-experiment
A toy interpreter for a toy version of ABAP.
## Getting started
1. Clone the repo.
2. 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).
3. Run the project as `node index.js` or event `./index.js`!## Usage
`node index.js --source [--input ]`
Input defaults to stdin.
## Project structure
* 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## Useful Makefile targets:
**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.