Giter Site home page Giter Site logo

starktech23 / mrustc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thepowersgang/mrustc

0.0 1.0 0.0 7.39 MB

Alternative rust compiler (re-implementation)

License: MIT License

Makefile 1.21% C++ 97.73% Lex 0.21% Yacc 0.56% C 0.28% Batchfile 0.01%

mrustc's Introduction

Mutabah's Rust Compiler

In-progress alternative rust compiler. Not yet suitable for everyday use.

Intro

This project is an attempt at creating a simple rust compiler in C++, with the ultimate goal of being a separate re-implementation.

The short-term goal is to compile pre-borrowchecked rust code into some intermediate form (e.g. LLVM IR, x86-64 assembly, or C code). Thankfully, (from what I have seen), the borrow checker is not needed to compile rust code (just to ensure that it's valid)

Getting Started

Linux

  • make RUSTCSRC - Downloads the rustc source tarball
  • make -f minicargo.mk - Builds mrustc and minicargo, then builds libstd, libtest, finally rustc

Windows

(NOTE: Incomplete, doesn't yet compile executables and missing helper scripts)

  • Download and extract rustc-1.19.0-src.tar.gz to the repository root (such that the rustc-1.19.0-src directory is present)
    • NOTE: I am open to suggestions for how to automate that step
  • Open vsproject/mrustc.sln and build minicargo

Building Requirements

  • C++14-compatible compiler (tested with gcc 5.4 and gcc 6)
  • C11 compatible C compiler (for output, see above)
  • curl (for downloading the rust source, linux only)
  • cmake (at least 3.4.3, required for building llvm in rustc)

Current Features

  • Full compilation chain including HIR and MIR stages (outputting to C)
  • Supports just x86-64 linux
  • MIR optimisations
  • Optionally-enablable exhaustive MIR validation (set the MRUSTC_FULL_VALIDATE environment variable)
  • Functional cargo clone (minicargo)

Short-Term Plans

  • Fix currently-failing tests (mostly in type inferrence)
  • Fix all known TODOs in MIR generation (still some possible leaks)
  • Fix compilation errors encountered when compiling cargo

Medium-Term Goals

  • Propagate lifetime annotations so that MIR can include a borrow checker

Progress

  • Compiles static libraries into loadable HIR tree and MIR code
  • Generates working executables (most of the test suite)
  • Compiles rustc that can compile the standard library and "hello, world"

Note: All progress is against the source of rustc 1.19.0

mrustc's People

Contributors

thepowersgang avatar est31 avatar equal-l2 avatar ubsan avatar guillaumegomez avatar oli-obk avatar sanxiyn avatar

Watchers

Samanvay Sharma 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.