Giter Club home page Giter Club logo

camljoos0's Introduction

Joos0 compiler

This is a simple compiler for a small subset of the Java(tm) programming language. The supported language, Joos0, is the smallest of a hierarchy of Java 1.3 subsets. For more language details and an overview of the hierarchy, see [https://services.brics.dk/java/courseadmin/dOvs2012/pages/The+Joos+Languages].

The compiler emits Java bytecode in the Jasmin format. You'll need to install the Jasmin assembler to turn the emitted .j files into .class files. For more information on Jasmin, see http://jasmin.sourceforge.net/.

To build the compiler you'll also need to install the Menhir parser generator, see http://gallium.inria.fr/~fpottier/menhir/.

The compiler was developed as part of (a previous version of) the undergraduate compiler course at Aarhus University.

To build:

$ make

To run:

Example 1:

$ ./joos0 tests/IntegerToString.java 
[...]
$ jasmin tests/IntegerToString.j
$ java -classpath . IntegerToString
Enter a number: 42
In base 8 that is: 52

(hence the program tests/IntegerToString.java compiles with the Joos0 compiler, the output can be assembled with Jasmin, and the resulting output run on the JVM)

Example 2:

$ ./joos0 tests/Cons.java tests/ConsMain.java
[...]
$ jasmin tests/Cons.j tests/ConsMain.j
$ java -classpath . ConsMain
truefalse

(hence the compiler supports programs that span multiple files)

Example 3:

$ ./joos0 tests/ClassName2.java 
[...]
Error at tests/ClassName2.java: line 3, col 11
    public A() throws Exception { }

Constructor must have the same name as its enclosing class

(hence the program is properly rejected by the compiler with an error message)

camljoos0's People

Contributors

jmid avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hsk

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.