Coder Social home page Coder Social logo

mit-6035-compiler-rs's Introduction

MIT 6.035 Compiler in Rust

Rust implementation of compiler project in mit 6.035 computer language engineering (Spring 2010)

Build

cargo build

Test

cargo test

Run

cargo run

Components

  1. Scanner and Parser (Front End)

    • use lalrpop
    • scanner: splits source file input to tokens
      • tokens can be operator, keyword, literal, string, or identifier
      • non-tokens such as white spaces are discarded in this phase
      • malformed tokens are reported and aborts compilation process
    • parser: reads tokens and check if it conforms to the language spec
      • matching braces
    • semicolons
    • not verified: type, function/variable name
    • outputs AST
  2. Semantic Checker (Front End)

    • checks various non-context-free constraints: e.g. type compatibility
    • builds symbol table that keeps user-defined types and location of each identifier
    • outputs IR
  3. Code Generation (Back-end) [todo]

    • generate unoptimized x86-64 assembly
    • object code conforming to ABI (Application Binary Interface)
  4. Data Flow Analysis (Back-end) [todo]

    • optimization pass
  5. Optimizer (Back-end) [todo]

    • multiple data flow optimization pass

mit-6035-compiler-rs's People

Contributors

felicityin avatar

Watchers

 avatar  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.