Skip to content

gmaldona/minijava-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A rewrite of the MiniJava Compiler written in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published