Home

Awesome

The New Decaf Compiler

<img src="https://github.com/decaf-lang/decaf/wiki/images/decaf-logo-h.svg?sanitize=true" width="300" align=center></img>

Decaf is a Java-like, but much smaller programming language mainly for educational purpose. We now have at least three different implementations of the compiler in Java, Scala and Rust. Since the standard language has quite a limited set of language features, students are welcome to add their own new features.

Getting Started

This project requires

Other dependencies will be automatically downloaded from the maven central repository by the build script.

After git clone, you need to setup submodules by

git submodule update --recursive --init

Build

Type the standard Gradle build command in your CLI:

gradle build

The built jar will be located at build/libs/decaf.jar.

Or, import the project in a Java IDE (like IDEA or Eclipse, or your favorite VS Code) and use gradle plugin, if available.

Run

In your CLI, type

java -jar build/libs/decaf.jar -h

to display the usage help.

Possible targets/tasks are:

To run the MIPS assembly code, you may need spim, a MIPS32 simulator. For Mac OS users, simply install spim with brew install spim and run with spim -file your_file.s.

Releases

See https://github.com/decaf-lang/decaf/releases for releases, including separate frameworks for PA1 -- PA3.

Materials

We have a couple of Chinese documents on the language specification and implementation outlines:

Development & Contribution

In future, we will develop on (possibly variates of) development branches, and only merge release versions into the master branch.

Issues and pull requests for fixing bugs are welcome. However, adding new language features will not be considered, because that's students' work!