Skip to content

azzyyzz/advanced-compilers

Repository files navigation

stella-implementation-in-java

Template for an implementation of Stella in Java.

Screenshot from Intellij IDEA

The template contains:

  1. Stella.cf — LBNF for Stella (can be used by BNF Converter tool);
  2. stellaLexer.g4 and stellaParser.g4 — grammar files for ANTLRv4 tool (generated by BNF Converter);
  3. org.syntax.stella.Absyn.* — classes for the abstract syntax of Stella (generated by BNF Converter);
  4. org.syntax.stella.VisitSkel — skeleton for a Visitor walking through an abstract syntax tree;
  5. org.stella.eval.Eval — placeholder for the evaluator for Stella;
  6. org.stella.typecheck.TypeCheck — the typechecker for Stella;
  7. org.stella.typecheck.VisitTypeCheck — the typechecking visitor for Stella's AST;
  8. org.stella.Main — entry point for the Stella typechecker/interpreter;
  9. org.stella.MainTest — some tests for the typechecker.

When implementing a typechecker, you should write your code primarily in org.stella.typecheck.VisitTypeCheck.

Build and run using terminal

You can use Maven to build the project in a single fat JAR file and run it.

Prerequisites

Build

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

Run command

java -jar target/stella-implementation-in-java-1.0-SNAPSHOT.jar

Updating grammar

bnfc --java-antlr Stella.cf -l -p org.syntax -o src/main/java

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages