robert-w-gries / javar

Java compiler written in Java
0 stars 0 forks source link

javar

A Java Compiler written in Java. It currently can compile simple Java programs to MIPS assembly format.

Building

Dependencies

IDE

Recommended: IntelliJ IDEA

Whille using an IDE, you can build and run by simply pressing "Run".

Build from command line

javac -d out -cp src/ src/Main.java

Usage

java -cp out Main --mips [inputfiles]

inputfiles is a space-separated list of at least one file path. The path can be absolute or relative to the current directory.

Available Target Architectures

Generating Parser using JavaCC

Usage

javacc -OUTPUT_DIRECTORY=src/frontend/parse/ src/frontend/parse/JavarParser.jj

Issues with javacc

Since 6.0, the advertised javacc script is not packaged in binaries. You will need to add the following script in javacc-7.x.x/target/ after building:

#!/bin/sh
JAR="`dirname $0`/javacc.jar"

case "`uname`" in
     CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;;
esac

java -classpath "$JAR" javacc "$@"

Note: Make sure that the JAR variable points to the correct location of the javacc.jar file.

Features

TODO

Current Plans

Future Plans

Known Issues