Giter Site home page Giter Site logo

minijava-compiler's Introduction

minijava compiler

"minijava" compiler written in java, compiles to x86-64. Minijava language grammar can be found online from a google search.

  • scanning implemented using JFlex (java implementation of flex)
  • parsing implemented using CUP (java implementation of bison)
  • semantic analysis, type checking, etc done using AST IR and visitor design paradigm, with symbol tables.
  • codegen, uses vtables for dynamic dispatch, offset tables for stack/heap allocation. Generates at&t x86-64.

building and running

This project uses the ant build system. It can be built using: $ant

once its build you can run the binary as: $java -cp build/classes:lib/java-cup-11b.jar MiniJava <option> <filename>

<filename> is the minijava file you want to compile.

<option> compiler options are as follows:

  • no option, will do all compilation steps and output compiled x86-64 to stdout
  • -S, will only do scanning phase of compiler and output tokens to stdout
  • -P, does scanning and parsing, prints the AST to stdout
  • -A, same as -P but prints AST in a different format
  • -T, does scanning, parsing, and semantic analysis, prints out the symbol tables to stdout

if you are testing out my compiler, SamplePrograms/SampleMiniJavaPrograms contains lots of good programs to test compilation on.

minijava-compiler's People

Contributors

kylemumma avatar roblburris avatar

Watchers

 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.