MiniJava is a subset of the Java language
A few examples of the MiniJava language can be found here.
The grammar used in this project comes from the grammar found on here.
- Java 20 (Oracle.com)
- Compiling MiniJava Grammar using Python3:
- Python3 (Python.org)
- Compiling MiniJava Grammar using Docker:
- Docker (Docker.com)
- The Antlr 4 Tools can be installed using python pip install. The following PyPi packages include the necessary tools to
compile a *.g4 file and generate the required Java classes:
- antlr4-python3-runtime version 4.12.0
- antlr4-tools version 0.1
Convenience scripts for building a virtual environment and downloading the necessary PyPi packages can
be found within the scripts/
directory.
- Navigate into the scripts directory and run the following commands
cd scripts && chmod +x build_env.python.sh compile_grammar.python.sh
./build_env.python.sh
./compile_grammar.python.sh
- Ensure Antlr4 Tools generated the correct files needed for the minijava.lang.MiniJava Compiler. A validation script
can be found within the
scripts/
directory.cd scripts && chmod +x validate.sh
./validate.sh
The original implementation was writen in Scala and can be found on GitHub. This newer and improved compiler implementation started as a side project for learning new Java 17 techniques.