Coder Social home page Coder Social logo

mjc's Introduction

Build Status

MiniJava Compiler (mjc)

This is a compiler for a slightly modified version of the MiniJava language described in Appel's Modern Compiler Implementation in Java. It was created as part of the course DD2488 Compiler Construction at KTH. The compiler targets the JVM and supports the basic language described here, with the following extensions:

Code Description
IWE 'if' statements with or without 'else'
NBD nested blocks with new variable declarations
ABC array bounds checks
CLE CGT CGE CEQ CNE comparison operators
BDJ logical OR connective

Documentation

Building

The compiler requires Java 7 or 8 and uses the Apache Ant build system.

Type ant in the top-level directory. The default Ant target builds the compiler, runs the unit tests, and produces the compiler JAR file (mjc.jar). See ant -projecthelp for other available targets.

Running

The compiler is invoked using the mjc script in the top-level directory. The available command line options are:

usage: mjc <infile> [options]
 -S             only output Jasmin assembly code
 -p             print abstract syntax tree
 -g             print abstract syntax tree in GraphViz format
 -h             show help message

For example, type ./mjc foo.java to compile foo.java. The result is written into the current working directory as a set of Jasmin assembly code files (.j), one file for each class, along with corresponding .class files from running the Jasmin assembler.

mjc's People

Contributors

estan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.