Giter Club home page Giter Club logo

jcp's Introduction

Java Compiler in Python (JCP)

This project is a part of the course Compiler Design (CS 335), IIT Kanpur. This is a Java compiler implemented in python3 with x86 as the target language.

This compiler is a multi-parse compiler, i.e., it first generates an AST (Abstract Syntax Tree form) file and then, it generates a TAC (Three Address Code) file which then is used for the generation of assembly files.

References

  • The grammar that we have used is taken from plyj

Setup

sudo pip3 install -r requirements.txt

Dependencies

  • pydot
  • ply

Usage

python3 jcp/parser.py [-g] path_to_file/file_name

-g: debug flag

Modules

  • jcp/

    • lexer.py: contains the token definitions
    • parser_rules.py: contains grammar rules and their corresponding actions
    • parser.py: initlizes parser and reads the file writes the output
    • ptg.py(parse tree generator): contains helper functions to generate parse tree
    • 3addrcode.py: generates TAC (Three Address Code) and it's corresponding assembly, object files
    • symbol_table.py: handles symbol tables for a program by having a class table
  • helper/

    • fileio.s: handles the file IO actions
    • mem.s: code for heap allocation
    • printing.s: code for stdio

jcp's People

Contributors

ndesh26 avatar rohithmukku avatar

Watchers

 avatar

Forkers

trisvol

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.