Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iglosiggio/antlr-experiment


https://github.com/iglosiggio/antlr-experiment

Last synced: 15 days ago
JSON representation

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.