Why am I writing a Rust compiler in C?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. gccrs

    GCC Front-End for Rust

    The community has been very supportive of the gccrs (https://github.com/Rust-GCC/gccrs) project, which is the main project to write a Rust compiler written in C.

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. onramp

    A portable self-bootstrapping C compiler

    It can be difficult to explain why bootstrapping is important. I put a "Why?" section in the README of my own bootstrapping compiler [0] for this reason.

    Security is a big reason and it's one the bootstrappable team tend to focus on. In order to avoid the trusting trust problem and other attacks (like the recent xz backdoor), we need to be able to bootstrap everything from pure source code. They go as far as deleting all pre-generated files to ensure that they only rely on things that are hand-written and auditable. So bootstrapping Python for example is pretty complicated because the source contains code generated by Python scripts.

    I'm much more interested in the cultural preservation aspect of it. We want to preserve contemporary media for future archaeologists, for example in the Arctic World Archive [1]. Unfortunately it's pointless if they have no way to decode it. So what do we do? We can preserve the specs, but we can't really expect them to implement x265 and everything else they would need from scratch. We can preserve binaries, but then they'd need to either get thousand-year-old hardware running or virtualize a thousand-year-old CPU. We can give them, say, a definition of a simple Lisp, and then give them code that runs on that, but then who's going to implement x265 in a basic Lisp? None of this is really practical.

    That's why in my project I made a simple virtual machine, then bootstrapped C on top of it. It's trivially portable, not just to present-day architectures but to future and alien architectures as well. Any future archaeologist or alien civilization could implement the VM in a day, then run the C bootstrap on it, then compile ffmpeg or whatever and decode our media.

    [0]: https://github.com/ludocode/onramp?tab=readme-ov-file#why-bo...

  4. rust

    Empowering everyone to build reliable and efficient software.

    > Not sure I follow - isn't rustc still only a compiler frontend to LLVM, like clang is for C/C++?

    The rustc source tree currently includes LLVM, GCC, and Cranelift backends: https://github.com/rust-lang/rust/blob/c6db1ca3c93ad69692a4c...

    (Cranelift itself is written in Rust.)

  5. live-bootstrap

    Use of a Linux initramfs to fully automate the bootstrapping process

    >From there they can bootstrap yacc, basic coreutils, Bash, autotools, and eventually GCC ... it’s a fascinating process.

    I would say about half of the list can be trimmed off if you managed to separate GCC 4 and binutils from their build scripts, notice the sheer amounts of items there are just repeatedly rebuilding auto-stuff and their dependencies[1].

    [1] https://github.com/fosslinux/live-bootstrap/blob/master/part...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • How hard would it be to port the Rust toolchain to a new non-POSIX OS written in Rust and get it to host its own development? What would that process entail?

    3 projects | /r/rust | 5 Jul 2023
  • GCC 13 and the State of Gccrs

    3 projects | news.ycombinator.com | 24 Apr 2023
  • Is there any other language that has something crucial that Rust hasn't? Minus libraries.

    5 projects | /r/rust | 30 Dec 2021
  • Librsvg, Rust, and non-mainstream architectures

    5 projects | /r/rust | 26 Feb 2021
  • Rust Needs an Official Specification

    1 project | news.ycombinator.com | 12 Nov 2024

Did you know that Rust is
the 5th most popular programming language
based on number of references?