summaryrefslogtreecommitdiff
path: root/README.md
blob: bcb93b8b0a566ac81b4eb5343276fa5c00d9cc77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Mutabah's Rust Compiler

_In-progress_ alternative rust compiler.

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)

Current Features
===
- Attribute and macro expansion
- Resolves all paths to absolute forms
- Converts name-resolved AST into a more compact "HIR" (simplified module and expression tree)
- Hackily evaluates constants
  - Constant evaluation is done by using duck-typing, which is then validated by the Type Check pass
  - This is how rustc did (or still does?) const eval before MIR
- Type inference and checking
- Closure and operator desugaring
- MIR generation (with partial validation pass)
- HIR/MIR (de)serialisation, allowing for `extern crate` handling
- C-based code generation
- Basic MIR optimisations (including inlining)

Short-Term Plans
===
- Parse and Typecheck all run-pass tests
- Compile a running rustc

Medium-Term Goals
===
- Extensive MIR optimisations
- Propagate lifetime annotations so that MIR can include a borrow checker


Progress
===
- Compiles the standard library into loadable MIR
- Compiles the "hello, world" test into compilable and running C code
- Compiles `rustc`
  - Generated code is likely not correct