Our great sponsors
- CodiumAI - TestGPT | Generating meaningful tests for busy devs
- SonarLint - Clean code begins in your IDE with SonarLint
- InfluxDB - Access the most powerful time series database as a service
- ONLYOFFICE ONLYOFFICE Docs — document collaboration in your environment
qbe-rs | c4 | |
---|---|---|
23 | 6 | |
45 | 8,145 | |
- | - | |
4.6 | 0.0 | |
5 months ago | 9 months ago | |
Rust | C | |
GNU General Public License v3.0 or later | GNU General Public License v3.0 only |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
qbe-rs
-
Made my first LLVM front-end… Now what?
You can try buildling you own backend like llvm. A good example or starting point is probably QBE since it is extremely small but very functional.
- Best book on writing an optimizing compiler (inlining, types, abstract interpretation)?
-
Rust port of B3 from WebKit, LLVM-like backend
How big is the whole backend? I've heard that it is small but I wanted to compare it to QBE which is around 8 KLoC and it is quite interesting too.
-
Few lesser known tricks, quirks and features of C
I think QBE might be what you're looking for?
-
Do you consider LLVM a complicated software? And are there any alternatives and how they compare to LLVM?
As far as I know, there is QBE, which is actually kinda underrated, and Cranelift, mainly designed for JIT compilation
Before that, I had spent a bit of time working with QBE, which is much simpler and really easy to write a frontend for. I switched to libgccjit though, because I got frustrated with a few of the things lacking from QBE (like the ability to easily keep track of where different variables live on the stack). I think for many hobby language projects, QBE would be a good option (my project was off the ground very fast using QBE, and I got pretty far before I ran into limitations I couldn't easily work around).
If one of your parameters is size/complexity of the backend and you prefer something smaller, have a look at qbe and cwerg
The alternatives are generally hidden inside of another compiler. The big exception seems to be qbe (https://c9x.me/compile/) however since the author appears to have written this code without peer review, it's not easy to read it's source code.
-
Smallest possible self-hosting zig compiler
So my question is this: if a backend like QBE (~12k Loc) was added to Zig and Zig only had to compile Zig code (no C, etc) for that QBE backend -- about how many LoC would that Zig need to be?
-
Building the fastest Lua interpreter.. automatically
GCC is written in C++ these days, so something like QBE(https://c9x.me/compile/) would be needed.
c4
-
vermin_vm: Virtual Machine(~400 lines) + Assembler(~800 lines) written in C
VMs with simple instruction sets is a fun topic. Some years ago I got inspired by the amazing rswier/c4 compiler by Robert Swierczek and explored the smallest instruction set I could get away with to create VMs that could run non-trivial workloads.
-
Hand-optimizing the TCC code generator
C4 comes to mind (C in 4 functions), https://github.com/rswier/c4.
have you considered adding a backend for LLVM? perhaps a bit heavyweight, but it could be a good way to get C/C++, fortran, rust, etc. if that's something you'd like!
- What is the simplest self-compiling subset of C?
-
Compilers Are Hard
...or in other words, "they're hard only because you make them hard".
That said, I think C4 makes a better example of how simple it can be:
https://github.com/rswier/c4/blob/master/c4.c
(Previously on HN at https://news.ycombinator.com/item?id=8558822 and https://news.ycombinator.com/item?id=22353532)
What are some alternatives?
minivm - A VM That is Dynamic and Fast
bcompiler - Mirror of http://www.rano.org/bcompiler.tar.gz, with a bootstrap script
ubpf - Userspace eBPF VM
stage0 - A set of minimal dependency bootstrap binaries
mir - A lightweight JIT compiler based on MIR (Medium Internal Representation) and C11 JIT compiler and interpreter based on MIR
cproc - C11 compiler (mirror)
Oberon - Oberon parser, code model & browser, compiler and IDE with debugger
Befunge - lang befunge 93 fast
Som - Parser, code model, navigable browser and VM for the SOM Smalltalk dialect
simplelanguage - A simple example language built using the Truffle API.
libcperciva - BSD-licensed C99/POSIX library code shared between tarsnap, scrypt, kivaloo, spiped, and bsdiff.
asmjit - Low-latency machine code generation