Template for an implementation of Stella in Java.
The template contains:
Stella.cf
— LBNF for Stella (can be used by BNF Converter tool);stellaLexer.g4
andstellaParser.g4
— grammar files for ANTLRv4 tool (generated by BNF Converter);org.syntax.stella.Absyn.*
— classes for the abstract syntax of Stella (generated by BNF Converter);org.syntax.stella.VisitSkel
— skeleton for a Visitor walking through an abstract syntax tree;org.stella.eval.Eval
— placeholder for the evaluator for Stella;org.stella.typecheck.TypeCheck
— the typechecker for Stella;org.stella.typecheck.VisitTypeCheck
— the typechecking visitor for Stella's AST;org.stella.Main
— entry point for the Stella typechecker/interpreter;org.stella.MainTest
— some tests for the typechecker.
When implementing a typechecker, you should write your code primarily in org.stella.typecheck.VisitTypeCheck
.
You can use Maven to build the project in a single fat JAR file and run it.
- Install Maven
Build a single fat JAR file using maven:
mvn clean package
This will create a file named stella-implementation-in-java-1.0-SNAPSHOT.jar
under the target
directory.
Run command
java -jar target/stella-implementation-in-java-1.0-SNAPSHOT.jar
bnfc --java-antlr Stella.cf -l -p org.syntax -o src/main/java