Giter Site home page Giter Site logo

pythiger's Introduction

Pythiger

Compiler for the Tiger programming language implemented in Python. Based on the books by Andrew Appel.

All source code can be found in src:

  • lexer: Chapter 2, Lexical Analysis.
  • parser: Chapter 3, Parsing and Chapter 4, Abstract Syntax.
  • semantic_analysis: Chapter 5, Semantic Analysis.
  • activation_records: Chapter 6, Activation Records.
  • intermediate_representation: Chapter 7, Translation to Intermediate Code.
  • canonical: Chapter 8, Basic Blocks and Traces.
  • instruction_selection: Chapter 9, Instruction Selection.
  • liveness_analysis: Chapter 10, Liveness Analysis.
  • register_allocation: Chapter 11, Register Allocation.
  • putting_it_all_together: Chapter 12, Putting it All Together.
  • examples: A list of Tiger programs provided by Appel.
  • tests: Integration tests for specific parts of the compilation process.
  • ply: Python Lex-Yacc. Used in chapters 2-4.

Setup

This project uses Python version 3.6.

From the project root directory, on a virtual Python environment (or not, if you're feeling brave), run:

pip3 install -r requirements.txt

Usage

Make sure src/compile.sh has execution permissions and that the src directory is added to your $PYTHONPATH environment variable.

From the src directory, run:

./compile.sh source_file

This will generate an executable in the src directory with the name a.out.

Tests

From the src directory, run:

python3 -m unittest

This will run both unit and integration tests for the entire project.

To run tests for a specific file or directory, use:

python3 -m unittest <PATH>

pythiger's People

Contributors

ggweinand avatar tomasfdel avatar sebastianmoline avatar

Stargazers

Alcides Fonseca avatar Max Bernstein avatar

Watchers

 avatar  avatar

Forkers

silverfips

pythiger's Issues

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.