All Projects → fivemoreminix → oxc

fivemoreminix / oxc

Licence: MIT license
The first C compiler written in Rust.. mostly unworking.

Programming Languages

rust
11053 projects
c
50402 projects - #5 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to oxc

monolithic.nvim
Neovim plugin to open multiple files in one buffer
Stars: ✭ 35 (-12.5%)
Mutual labels:  experimental
r3
R3-OS — Experimental static (μITRON-esque) RTOS for deeply embedded systems, testing the limit of Rust's const eval and generics
Stars: ✭ 87 (+117.5%)
Mutual labels:  experimental
MakeYourOwnNN-Persian
Persian translation of Make Your Own Neural Networks book by Tariq Rashid
Stars: ✭ 18 (-55%)
Mutual labels:  educational
interaction-design-in-a-nutshell
A dense, clearly defined, and small guide to interaction design
Stars: ✭ 13 (-67.5%)
Mutual labels:  educational
SilentETHMiner
A Silent (Hidden) Ethereum (ETH & ETC) Miner Builder
Stars: ✭ 219 (+447.5%)
Mutual labels:  educational
ethmerge.com-content
Markdown formatted content for the ethmerge.com website.
Stars: ✭ 29 (-27.5%)
Mutual labels:  educational
Mirai
Mirai 未来 - A powerful Minecraft Server Software coming from the future
Stars: ✭ 325 (+712.5%)
Mutual labels:  experimental
Mastering-Algorithms-with-C
This repository contains example files organized by chapters in Mastering Algorithms with C, by Kyle Loudon
Stars: ✭ 48 (+20%)
Mutual labels:  educational
PyGameofLife
Conway's Game of Life using python's matplotlib and numpy
Stars: ✭ 40 (+0%)
Mutual labels:  educational
PocketAI
Addon compatible AI plugin for PocketMine-MP
Stars: ✭ 25 (-37.5%)
Mutual labels:  experimental
magic-web
Discover all the amazing things your browser can do
Stars: ✭ 39 (-2.5%)
Mutual labels:  educational
google-cloud-rust
No description or website provided.
Stars: ✭ 148 (+270%)
Mutual labels:  experimental
gds course
Geographic Data Science, the course
Stars: ✭ 60 (+50%)
Mutual labels:  educational
SilentCryptoMiner
A Silent (Hidden) Free Crypto Miner Builder - Supports ETH, ETC, XMR and many more.
Stars: ✭ 547 (+1267.5%)
Mutual labels:  educational
FortranTip
Short instructional Fortran codes associated with Twitter @FortranTip
Stars: ✭ 39 (-2.5%)
Mutual labels:  educational
unpackai
The Unpack.AI library
Stars: ✭ 20 (-50%)
Mutual labels:  educational
kotoba
A Discord bot for helping with learning Japanese.
Stars: ✭ 118 (+195%)
Mutual labels:  educational
LogicalDefence
An open source Android app that displays a list of the logical fallacies that haunt every rationalists world
Stars: ✭ 106 (+165%)
Mutual labels:  educational
generative
A digital playground for experimenting with creative coding and WebGL
Stars: ✭ 50 (+25%)
Mutual labels:  experimental
docs-lovelace
Documentation for Home Assistant Experimental UI: Lovelace
Stars: ✭ 42 (+5%)
Mutual labels:  experimental

Summary

A C compiler written in Rust for experimentation and understanding compilers. Should be easy to fork from and work with. Everything is handwritten and the compiler uses no third-party libraries.

Please keep in mind, the compiler is currently EXPERIMENTAL, and is NOT PRODUCTION READY.

The compiler is roughly following this article.

Backend

The compiler generates 32-bit AT&T-style assembly. The backend can be easily replaced with any other. The code generator uses a recursive descent style similar to the parser. See src/generator.rs.

Where The Language is Right Now

All valid tests/stage_1 through tests/stage_8.

Testing

$ cargo build
...
$ .\target\debug\oxc.exe .\test\stage_7\valid\consecutive_declarations.c
.\test\stage_7\valid\consecutive_declarations.c:
int main() {
    int a = 0;
    {
        int b = 1;
        a = b;
    }
    {
        int b = 2;
        a = a + b;
    }
    return a;
}

Lexically analyzed in 0.000175057s: option 'lex' to print tokens

Parsed in 0.0018207730000000001s:
Function(
    Function(
        "main",
        [
            Declaration(
                Declare(
                    "a",
                    Some(
                        Const(
                            0
                        )
                    )
                )
            ),
            Statement(
                Compound(
                    [
                        Declaration(
                            Declare(
                                "b",
                                Some(
                                    Const(
                                        1
                                    )
                                )
                            )
                        ),
                        Statement(
                            Expr(
                                Some(
                                    Assign(
                                        Assignment,
                                        "a",
                                        Var(
                                            "b"
                                        )
                                    )
                                )
                            )
                        )
                    ]
                )
            ),
            Statement(
                Compound(
                    [
                        Declaration(
                            Declare(
                                "b",
                                Some(
                                    Const(
                                        2
                                    )
                                )
                            )
                        ),
                        Statement(
                            Expr(
                                Some(
                                    Assign(
                                        Assignment,
                                        "a",
                                        BinOp(
                                            Plus,
                                            Var(
                                                "a"
                                            ),
                                            Var(
                                                "b"
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    ]
                )
            ),
            Statement(
                Return(
                    Var(
                        "a"
                    )
                )
            )
        ]
    )
)

Generated assembly in 0.097695794s:
  .globl _main
_main:
  push %ebp
  movl %esp, %ebp
  movl $0, %eax
  movl %eax, -4(%ebp)
  movl $1, %eax
  movl %eax, -8(%ebp)
  movl -8(%ebp), %eax
  movl %eax, -4(%ebp)
  addl $4, %esp
  movl $2, %eax
  movl %eax, -12(%ebp)
  movl -4(%ebp), %eax
  movl %eax, %ecx
  movl -12(%ebp), %eax
  addl %ecx, %eax
  movl %eax, -4(%ebp)
  addl $4, %esp
  movl -4(%ebp), %eax
  jmp _main_epilogue
  addl $4, %esp
  movl $0, %eax
_main_epilogue:
  movl %ebp, %esp
  pop %ebp
  ret

Assembling...
Assembled in 0.218045083s
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].