Skip to content

Latest commit

 

History

History
50 lines (42 loc) · 2.11 KB

README.md

File metadata and controls

50 lines (42 loc) · 2.11 KB

A compiler for MiniJava

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.

Requirements for the MiniJava Compiler

Building The MiniJava Compiler

Build by Installing Python Tool Chain

  • 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.

Steps:

  1. 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 
  2. 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

Build Using Docker


Historical Note: This is a post-graduation attempt of re-writing the MiniJava Compiler.

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.