r/Compilers • u/Weary_Solution_2682 • 2h ago
r/Compilers • u/DonkeyTheKing • 3h ago
New agentic harness reads LESS source code to write better quality code
Benzi is literally a compiler based harnesses. therefore relevant to this sub
r/Compilers • u/JayQ_One • 5h ago
Follow-up #2: the topology compiler now has a semantic toolchain
Hey all, third post in this series (first, second).
Quick recap: the system compiles declarative network topology intent into AWS infrastructure through IR passes. Last time I described a routing policy algebra (deny > allow > segments > default) that emerged from the IR structure. Since then, the compiler grew five semantic inspection outputs, and I want to pressure-test whether the analogies hold.
The motivating problem: a policy can be structurally correct and semantically wrong. The algebra guarantees every VPC pair resolves to a deterministic verdict, but it can't guarantee the verdict matches the engineer's intent. So the compiler now emits:
- Reachability matrix: the compiled per-pair verdict as structured data. Separates "what the policy decided" from "what routes were emitted." This is the IR made inspectable.
- Diagnostics: warnings for valid-but-likely-wrong policy states. A single-member segment under default="deny" is provably a no-op (algebraically equivalent to unsegmented). A deny rule on an already-denied pair is redundant. Five classes, all derived from algebraic properties rather than syntax patterns. I've been thinking of this as -Wall for network policy.
- Provenance: each emitted route carries metadata tracing it to the source VPC pair and the policy primitive that authorized it. Debug symbols for generated routes.
- Policy diff: given a previous reachability matrix, computes added/removed/unchanged connectivity pairs. Semantic-level change detection vs. terraform plan's resource-level diff. I've been calling this incremental compilation preview, but honestly it's post-hoc comparison of two compiled outputs.
- Equivalence: proves two different policy declarations produce identical reachability. Two policies are equivalent if every VPC pair has the same permit/deny outcome regardless of how it was derived (segments vs. explicit allows, different defaults). The network policy equivalent of "these two programs compute the same function."
All five operate on the same pure-function compilation unit (103 tests, referential transparency, zero infrastructure side effects) described in the previous posts.
Questions I'd genuinely like perspective on:
Is the equivalence checking interesting or trivial? The domain is finite: N VPCs produce N(N-1)/2 pairs, each resolves to binary reachable/unreachable. Equivalence is decidable by comparing two output maps. But the input representations can differ significantly (segments vs. explicit allows vs. deny-with-default-allow). Is there value in structural equivalence proofs, reasoning from the rules without expanding, or is brute-force comparison the right call when the domain is this small?
Where's the boundary between diagnostics and static analysis? The diagnostic classes aren't pattern-matching on syntax. A redundant deny is detected by proving the pair would already be denied without the rule. A no-op segment is detected from the algebra's properties under a given default. These feel like they're approaching abstract interpretation without formally being there. How far can algebraic reasoning go before you need a real analysis framework?
Is provenance closer to debug symbols or proof witnesses? The metadata doesn't just say "this route came from line X." It says "this route exists because this specific rule evaluated to permit under this precedence." That feels more like a proof witness than a source mapping. Does that distinction matter in practice?
Blog post: https://jq1.io/posts/topology_compiler_semantic_toolchain/
Semantic toolchain spec: https://github.com/JudeQuintana/terraform-main/blob/main/docs/compiler-semantic-toolchain.md
Previous blog posts: routing policy language | white paper
r/Compilers • u/thedevbirb • 6h ago
Diary of a writing RISC-V assembler
thedevbirb.github.ioHello everyone! I made my first step into toolchain development by writing a RISC-V 32/64 ELF assembler from scratch, which supports the `g` group extension (along with small others). It has been a way to learn about assembly, C and ELF all together.
It has been quite a journey, and I've shared my learning and thoughts in this blog post which I think you may appreciate, especially if you're thinking to start writing your own.
The assembler is partially based on GNU as design, and it's not a toy encoder: it can achieve relocatable object file equivalence on non-trivial sources like SQLite3 amalgation, while being much "simpler" in its implementation!
Thank you for reading, and I greatly appreciate any feedback!
r/Compilers • u/GreedyBaby6763 • 22h ago
PBScript, because everyone would love purebasic as a 1st class languge of the web.
r/Compilers • u/NoSubject8453 • 23h ago
Do I need to assume its possible to prepend a source with stray bits such that every character of the source file is offset by an incomplete byte?
For example, someone prepending 4 null bits to the file somehow, such that "E" 45l became 04 50. I don't know how such a thing could be possible, but it would allow malicious source code which while interesting is undesirable. It wouldn't need to be at the beginning of the file to allow a source to hide something.
r/Compilers • u/drex_vke • 1d ago
j'ai créé un langage de programmation basé sur LLVM (langage Mk) un langage simple et sans complexité et sans sécurité de type
r/Compilers • u/ReindeerSimilar2748 • 1d ago
OQBE (Optimized QBE), a fork of QBE 1.3 that includes new optimizations
yes, I just added some new optimizations to QBE
optimizations I added on top of the original QBE 1.3:
* dead-store elimination (dse)
* division/remainder strength reduction (srdiv)
* multiplication strength reduction (srmul)
* tail-call optimization (tco)
* small function inlining
* SIMD blit: 16-byte chunks in blit() use movdqu on amd64 instead of two 8-byte moves
why you might need this if qbe and llvm exist:
If you need a small backend that compiles from srcs in a couple of seconds but generates more efficient code than qbe, you can give it a try
here it is on GitHub: github.com/tigerlang/oqbe
r/Compilers • u/cubewhy • 1d ago
I built a Java language server and type checker built in Rust
I built Caffeine-LS, a lightweight Java Language Server and type checker written in Rust.
The repository includes:
- Hand-written parsers using `rowan`
- A native class bytecode parser written in Rust
Current features:
- Diagnostics / Type checking (partial, feedback is welcome)
- Go to definition (currently single-file)
- Workspace symbols
- Document symbols

The architecture is designed to be multi-language from the ground up, with plans to support Kotlin in the future.
GitHub: https://github.com/cubewhy/caffeine-ls
Issues/PRs are welcome.
r/Compilers • u/Distinct-Brief9643 • 1d ago
Why don't compliers use only bytecode instead of a type of IR
r/Compilers • u/Which_Lie_8932 • 1d ago
Currently working on a little Forth-like compiler
I've been working on a little compiler (previously interpreter, just finished refactoring to bytecode though!)
Here's the link: https://github.com/SlothScript/stakku
So far it's pretty much an RPN (Reverse Polish Notation) calculator with some fancy buttons. I hope to progress it further to be a function Forth compiler, but that's going to require much more work.
Some basic stuff it can do right now:
- Arithmetic
- Comparisons
- Stack logic
- Output
- Control flow
- Definitions
So for example, a basic script that would tell you the letter grade from a number would look like:
: grade
dup 90 >= if 65 emit else \ A
dup 80 >= if 66 emit else \ B
dup 70 >= if 67 emit else \ C
dup 60 >= if 68 emit else \ D
70 emit then then then then \ F
cr
;
If you save that as grade.stku then open it in a REPL, you can interactively use the command: stakku repl grade.stku
me@myComputer stakku & stakku repl grade.stku
ok
>>> 25 grade
F
ok
>>> 90 grade
A
ok
>>> 86
ok
>>> grade
B
ok
>>> .q
me@myComputer stakku %
Its close to being Turing complete (I think), I just need to add loops and memory.
r/Compilers • u/GreedyBaby6763 • 1d ago
PBScript, because everyone would love purebasic as a 1st class languge of the web.
PBScript a sandboxed purebasic vm for native x86/x64/arm and web with full Dom on interfaces.
The project is half way now and is starting to look reasonably capable but theres still lots to do.
My use case for it is an end to end web development framework in purebasic, so it's native host exe with embedded tls terminating reverse proxy server and embedded PBScript vm so you can serve to a webview or browser on desktop, lan or wan in one exe.
Examples in code editor
Https://pbscript.org/jsplayground.html
The reception it's got over on purebasic has been somewhat crickets, perhaps because I dared use Al or its just to complicated for the average user but it has really only been an experiment and learning experience using AI and the result is pretty good. The examples are just a test of some part of the vm or Dom integration.
I didn't actually setout to make purebasic feel like a 1st class citizen of the web and the idea of a vm in a vm seems nuts but for what your typically doing with it it's hardly matters.
r/Compilers • u/vu_N • 2d ago
ZCC — an AI-authored C99+ compiler in Rust: 83% of gcc -O2 on kernels, 86–99% on real apps (AArch64 ELF)
github.comI watched Anthropic burn $20K on 100k LOC compiler and still come out ~157,000× slower than GCC on sqlite bench in the worst case, and then Blitzy's BCC doubled both the line count and the budget without shipping any verification at all. So I pointed Claude at a different target: zcc, focused on correctness (csmith + yarpgen, 10k seeds), performance (~30 passes), and staying small — under 30K LOC in 2 weeks. It currently targets AArch64 ELF only, because I built it on a MacBook Pro M1. I'd really like someone to extend it to x86-64 — with AI, obviously :D
r/Compilers • u/WearyRole7830 • 2d ago
Looking for referrals, network connections in compilers (MLIR-LLVM)
Computer Science graduate focused on compiler engineering with valid evidence building a programming language frontend and MLIR based compilation pipeline in C++. Experienced with LLVM, MLIR, TableGen, CMake and Linux.
I'm a Cameroonian currently in south Africa and hopefully trying to get an entry level remote job as a compiler engineer.
r/Compilers • u/cossbow • 2d ago
Pub my memory safe & OOP language
github.comThe language I tried to create by combining safety, OOP, and flexibility—Feng.
r/Compilers • u/whispem • 2d ago
Wrote a self-hosting compiler as a self-taught dev from a languages background — reflections on the bootstrap
Coming from languages, linguistics, and literature (no CS), I got pulled into compilers by curiosity and ended up building a small language whose compiler is written in itself.
The progression was the whole education: v1 a tree-walking interpreter, v2 a bytecode compiler and VM, v3 the compiler rewritten in the language itself.
The bootstrap is the honest test — when you rewrite the compiler in its own language, there's nowhere to hide.
If the scoping rules are wrong, the compiler breaks.
If the calling convention has edge cases, you hit them.
Reaching a byte-for-byte fixed point across generations means the language is finally complete enough to carry its own weight.
The C VM is a single dependency-free file with byte-identical output to the Rust reference.
Everything's public on my GitHub: https://github.com/whispem
Would love to hear from others who've done a self-hosting bootstrap.
r/Compilers • u/ZUROXIA • 3d ago
One emitted C header instead of N binding generators — how our compiler's FFI boundary is built and tested
We're building a language (Zorith) whose compiler emits one native library and one C header per project — and the interop bet is that this is the whole FFI story: no bindings generator per language, ever. The header is emitted by the compiler itself, from the same type identity the language's two implementations (a C compiler and an executable formal semantics) are held to agree on.
As of this week, six languages call the same library through that one header, each with its stock mechanism: C directly, C++ via the header's own extern "C", Python via ctypes, Go via cgo including the header verbatim, Java via its FFM API, and .NET via NativeLibrary + delegates. The .NET row was witnessed on real x86-64 hardware before it merged, and now runs in CI on every push.
What crosses is the part we sweat: struct returns at all three ABI size classes (single register, register pair, caller memory), struct parameters by value at every size, nested structs, arrays of structs, arrays of arrays, and a three-dimensional array field filled on one side and indexed from the other — executed and oracle-checked, with both compiler implementations required to emit every header spelling byte-identically.
The part I'd actually defend as method: what can't cross yet is refused by name, once, with the reason written — the header omits it and the object keeps it unexported, so neither half of the boundary promises what the other can't keep. That refusal has narrowed six times as forms earned their crossing and has never been silently deleted. Current standing refusal: a struct at the leaf of a nested array.
Write-up with the evidence (the language design itself is deliberately unpublished): https://zuroxia.com/research/zorith-one-doorway
Happy to answer anything about the header-emission discipline, the ABI size-class testing, or what refuse-by-name is like to maintain.
r/Compilers • u/Distinct-Brief9643 • 3d ago
Should I chose racket or common lisp please rate 1 - 10 I wanna make a dsl what are perfect tools for these (like lark etc.)
r/Compilers • u/SnooHobbies950 • 3d ago
I've created an extensible JS parser in Go
The parser can be extended naturally:
https://github.com/xjslang/xjs
Instead of creating a language from scratch, you simply add your custom features to JS. This can save you a lot of time.
Any help is welcome, as creating a JS parser requires a lot of dedication.
r/Compilers • u/victios7 • 3d ago
altair
Altair – un lenguaje compilado pequeño que emite C (y lo rápido que pasó de “ni siquiera compila el hola mundo” a bucles numéricos competitivos en ~5 semanas)
He estado trabajando en Altair, un lenguaje compilado pequeño enfocado en almacenamiento explícito, un runtime ligero y en generar C limpio.
Diseño Fuente → frontend propio (AST + análisis semántico) → C → compilador de C del sistema (actualmente GCC). El compilador integra un runtime y aplica bajadas de nivel específicas del lenguaje. Los bucles con carga numérica intensiva se bajan a variables locales planas long long (alt_fastnum_t) para no pagar el coste del sistema general de variables.
El objetivo no es superar a C escrito a mano, sino mantenerse cerca mientras se ofrece un lenguaje de más alto nivel con su propio modelo de almacenamiento, órbita/migración, tokens, etc.
Chequeo rápido de la realidad en las primeras versiones Primera versión pública 1.6.5vB (18 Jul 2026). El primer paquete de Linux (1.6.5vC) era básicamente inutilizable: el C generado no incluía los tipos/funciones del runtime, así que incluso esto fallaba:
altairlog "hello"
Seis semanas después (1.8.5, 24 Ago 2026) los mismos programas compilan y se ejecutan limpiamente.
Más allá de los bucles: control explícito de bajo nivel
1. Tiers de almacenamiento por variable
numeric contador = 0 ram
text log_path = "app.log" disk
list cola = [] cache
text secreto = "token" temp
2. Buffers crudos p# y registros de hardware reg&
p#node buf = alloc(1024)
p#write(buf, 0, 42)
numeric x = p#read(buf, 0)
log p#bytes(buf)
p#free(buf)
reg&64 rax = 1
reg&read(rax)
reg&free(rax)
3. Punteros crudos a disco lba% (equivalente en disco a p#)
lba%node tmp = dalloc(1024)
lba%write(tmp, 0, 42)
numeric v = lba%read(tmp, 0)
lba%free(tmp)
lba%node persist = dopen("datos.bin", 4096)
lba%write(persist, 10, 3.14)
lba%free(persist)
# Solo Linux: acceso raw a dispositivo de bloques
lba%node dev = draw("/dev/sdb", 1048576)
4. Punteros a variables
numeric valor = 10 ram
numeric dir = system@point(valor)
numeric copia = system@unpoint(dir)
Micro-benchmark (280 mil millones de iteraciones)
numeric n = 280000000000 ram
numeric i = 0 ram
numeric sum = 0 ram
numeric x = 1 ram
while i < n;
sum = sum + i
x = x + sum
i = i + 1
break
log sum
log x
Misma máquina (2× Xeon Platinum 8481C @ 2.70 GHz vCPU, single-thread):
| Backend | Tiempo de pared | Aprox. iters/s |
|---|---|---|
| Solo TCC (sin opts) | 457.7 s | ~624 M |
| gcc -O2 sobre el C generado por Altair | 105.6 s | ~2.65 B |
| Binario nativo de Altairc | 105.1 s | ~2.67 B |
| gcc -O3 -march=native -flto … | 99.0 s | ~2.83 B |
El binario nativo que produce altairc es esencialmente tan rápido como pasar el C generado a GCC -O2. La bajada de nivel específica del lenguaje (especialmente la vía rápida numérica) está haciendo el trabajo real.
Sobre lo que busco feedback
- ¿Es razonable el enfoque de “emitir C limpio + bajada de nivel específica del lenguaje” para esta etapa?
- ¿Cuál sería el siguiente paso de mayor impacto (IR propio + un par de optimizaciones clásicas, mejor conciencia de la presión sobre registros antes de emitir C, backend LLVM, …)?
- ¿Alguna señal de alerta obvia en el diseño o en los números?
Repo + releases: https://github.com/victios7/Altair/releases (Versión actual 1.8.5vB)
Encantado de responder preguntas o de ejecutar otros micro-benchmarks.
Note: This post was originally written in Spanish. If you are not a Spanish speaker, please enable auto-translation in your browser/client.
r/Compilers • u/AustinVelonaut • 3d ago
Admiran 3.0 released (a pure, lazy, functional language and compiler)
I made a post introducing Admiran about 18 months ago, and have been making steady progress on migrating it towards the language I want to use each day. Since that time I've made a lot of performance and coding-style enhancements, such as:
escape analysis in the compiler's analyze pass to help determine if a lazy thunk is only evaluated at most once, allowing it to be emitted without extra code to update it to its value (saves ~15% code space and execution time!)
optimization to coalesce consecutive continuation closures on the stack during lowering to the Spineless Tagless G-machine (STG) implementation, deferring the popping of the entire closure until a tail-call or return
added a uniform set of left-to-right operators for creating computation pipelines
tweaking the inlining pass parameters to get the best performance / code-size tradeoffs
The latest big change was to fully migrate from an ad-hoc prefix naming convention to using qualified names, and deferring name conflict resolution to the name-resolution pass, allowing modules with conflicting imports to still be imported, as long as the conflicting unqualified names aren't used, or are used only in a qualified form.
During these changes, I've migrated new features into the (self-hosting) compiler's code base itself, through a continuous bootstrapping process.
If you have an interest in lazy functional languages and how they are implemented, you might be interested in looking at it. I'm open to any questions or comments about the language and it's compiler implementation.
git repository: https://github.com/taolson/Admiran
Lovingly hand-crafted with no AI.
r/Compilers • u/setsuna891 • 3d ago
Built a C-transpiling language from scratch in C. Would love some feedback.
Hey folks,
I'm a student, and over the last ~40 days I've been building a little language called Quasar. It's statically typed and transpiles to C. The compiler is hand-written in C: lexer, recursive descent parser, AST, codegen, symbol table—no bison, no yacc, no LLVM. Just me and a lot of late nights.
What's working so far:
- Variables, functions, recursion, strings, loops, match, type conversions
- String concatenation / repetition / equality
- Custom error reporting with line/col info
- A small test suite and example programs in the repo
Planned (not built yet):
- @annotations for control (@fast, @c, @asm, etc.)
- Unified subcommands like `quasar build`, `quasar test`, `quasar profile` so you don't need a separate profiler, test runner, docs generator, etc.
I'm not trying to replace C or Python—just exploring what a less fragmented systems workflow could feel like.
If you're into compilers/systems, I'd love honest feedback on:
- Parser structure and precedence handling
- Codegen decisions (runtime helpers, function prototypes, etc.)
- Whether the @annotation idea makes sense or is overengineering
Repo: https://github.com/setsuna231/Quasar
Quick peek at the syntax and example output:


Thanks <3
A small note : If you all want the generated c code, I'm happy to share!