Giter Site home page Giter Site logo

py-icg's Introduction

CS335A: Compiler Design (Assignment 3: INTERMEDIATE CODE GENERATOR)

  • Source Language: Python

  • Target Language: MIPS Assembly

  • Implementation Language: Python

  • Authors: Abhilash Kumar, Arnab Ghosh and Saurav Kumar

  • Tool Used : PLY (Python Lex and Yacc)

Three Address Code Representation


  1. Representation: regDest, regSrc1, regSrc2, op

  2. Operators:

    • HALT
    • JUMP_RETURN
    • PARAM
    • SW
    • LW
    • =
    • PRINT
    • GOTO
    • RETURN
    • COND_GOTO
    • %
    • /
    • <
    • =

    • <=
    • ==
    • !=
    • |
    • ^
    • &
    • not
    • and
    • or
    • <<

Running Instruction


  1. Run the makefile
make
  1. To run the IR Generator, pass the path of filename as argument.
bin/irgen test/<filename>.py
  1. To clean the executables and other helper files, run make clean.
make clean

Directory Structure


  • bin:
    • converter.py [Python source file to convert the dump of parser into dot file: may be needed for debugging]
    • lex.py [Python source file from PLY for lexing]
    • lexer.py [Python source file to specify language lexemes]
    • irgen [Python dependent bytecode for parsing and semantic analysis]
    • parser.py [Python source file to specify grammar]
    • yacc.py [Python source file from PLY for parsing ]
    • symbolTable.py [Python source file with necessary functions related to symbol table]
    • tac.py [Python scource file with necessary functions related to Three Address Code Representation]
  • src:
    • converter.py [Python source file to convert the dump of parser into dot file: may be needed for debugging]
    • lex.py [Python source file from PLY for lexing]
    • lexer.py [Python source file to specify language lexemes]
    • irgen [Python dependent bytecode for parsing and semantic analysis]
    • parser.py [Python source file to specify grammar]
    • yacc.py [Python source file from PLY for parsing ]
    • symbolTable.py [Python source file with necessary functions related to symbol table]
    • tac.py [Python scource file with necessary functions related to Three Address Code Representation]
  • test:
    • 'filename'.py [Test files]
  • .gitignore
  • makefile [To move the source files to bin directory and compile bytecode for lexer and making it executable]
  • readme.md

py-icg's People

Contributors

2020saurav avatar abhilak avatar

Watchers

James Cloos avatar Shyam Sunder 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.