r/Compilers • • 4h ago

How many of you here use AI for compilers?

14 Upvotes

Just curious. Often see people who use AI assistance or who just vibecode whole project. And on the other side I often see people who hate any AI usage.

How many of you here use AI in any case (would like to know in what case btw)? What is your criteria(s) to trust AI in compilers engineering?

Sorry for English, not my native language. Thanks for your attention

EDIT: Why downvote, just a basic interest 🫩


r/Compilers • • 9h ago

Is it inevitable for all mature languages to move to LLVM or write their own backend?

10 Upvotes

For a month I have been writing a compiler for my own language. I started testing it from last few days to port C programs like Puff.c and JSMN. It's closed source, and being honest: it's miserably slow. The basic idea was a Go-Rust like ARC with contracts. I broadly understand that you can only take three ways:

  1. LLVM backend
  2. Clang which is LLVM's optimizer, but C is the ceiling: This is my case.
  3. Write your own backend: A task too big to even entertain at prototype level.

Only language which takes the second route, and comes out as fast is Nim, but I am not sure how it works under hood. They are also developing Nimony(worth a look) to take a new approach before Nim 3.0


r/Compilers • • 5h ago

I am working on an interpreted language, your thoughts?

4 Upvotes

So it is VERY Pythonic, looks like this:

```

let x = 10

print(len(str(x)))

```

The code snippet above should compile to the one below. The question I have is how do I compile it? Currently I iterate over a list of tokens using an unsigned integer.

```

push 10

push x

build_var

get_name x

push str

call

push len

call

push print

call

push 0

push exit

call

```


r/Compilers • • 6h ago

BIPLAN - An interpreter and its compiler in 24KB

Thumbnail github.com
5 Upvotes

The development of BIPLAN started in 2017. I wrote both the compiler and the interpreter from scratch avoiding external libraries, frameworks and the influence of compiler and interpreter design studies, learning by doing and evaluating results. In 9 years of experiments I wrote BCC, a pre-processor and a multi-pass compiler capable of syntax and lexical analysis (701 lines of code), and BIPLAN, a register-based virtual machine implemented with a recursive descent parser (874 lines of code).

What do you think about it?


r/Compilers • • 9h ago

i wrote my own programming language

Thumbnail github.com
4 Upvotes

Ribbath

Ribbath is a Rust-native web framework for file-based routing, server-rendered .rib templates, and static exports. darkrib is its component kit, with light and dark themes and self-hosted Montserrat.

Live demos: native framework demo (this repository, deployed from the static export) · legacy JavaScript toolchain example

I’m still new to this journey—it’s my first experience—and I really hope it goes as I’ve envisioned. I’d be so happy if you could star the project on GitHub. Thanks!


r/Compilers • • 1d ago

What Makes PEG Unparsing Difficult?

Thumbnail blog.wybxc.cc
21 Upvotes

r/Compilers • • 17h ago

New MIT-Licensed Ramanujan interpreter beating CPython: performance matrix

0 Upvotes

Motivation

Ramanujan is built as the execution runtime for a distributed volunteer computing platform[Ramanujan-Computing]. In traditional volunteer computing projects, researchers have to cross-compile and ship platform-specific native binaries for every OS and architecture whenever they introduce a new problem. With Ramanujan, simulation writers simply write standard Python code once, and the lightweight runtime executes its IR deterministically across heterogeneous volunteer devices—from desktops to Android phones, smart TVs, and smart appliances where shipping CPython's full runtime overhead isn't practical

Summary

Ramanujan runs a statically typed subset of Python through a native interpreter. I wanted to see how it compares with CPython on one machine. I ran 34 CPU-only workloads, from a 42-line Mandelbrot script to a two-pass assembler, graph algorithms, and object-heavy data structures like segment trees and tries. Both engines ran the same Python source without changes.

On an Apple M3, the geometric-mean speedup was 1.92× against CPython 3.12.2 running precompiled .pyc files directly, and 1.69× with CPython's -S flag, which skips importing site. These are whole-process timings, not interpreter-loop timings: startup, loading, execution, and shutdown are included, as is Ramanujan's IR linking. Source compilation is excluded on both sides.

In a separate memory benchmark, Ramanujan had a lower median peak physical footprint on 32 of 34 workloads. Across the suite, CPython's footprint was 1.63× Ramanujan's (geometric mean of the per-workload ratios). Unlike the timing runs, the memory runs used .py source for CPython, not .pyc files.

Wall time

Median / p99 in milliseconds, from 100 interleaved fresh-process runs per workload and configuration. Ramanujan runs native X.pb <entry> 1; CPython runs python3 X.pyc or python3 -S X.pyc (-S skips importing site). Neither timing includes source compilation. Both include process startup, loading, execution, and shutdown; Ramanujan also links its IR on every run. Speedup = CPython median / Ramanujan median.

Ramanujan had a lower median on all 34 workloads against both CPython baselines.

OOP workloads (20)

Geometric-mean speedup: 2.07x vs default CPython; 1.78x vs -S.

WorkloadRamanujanCPython .pycCPython -S .pycSpeedupSpeedup vs -S
method-reuse8.29 / 10.1119.19 / 20.2616.74 / 18.802.32x2.02x
factory-return5.79 / 6.3513.16 / 16.5310.85 / 11.432.27x1.87x
polymorphic-dispatch12.87 / 15.3729.95 / 31.8227.55 / 28.862.33x2.14x
none-linked-list6.59 / 16.4714.96 / 26.6412.60 / 22.412.27x1.91x
bst-none-children9.36 / 10.1116.93 / 18.8014.58 / 15.741.81x1.56x
isinstance-dispatch13.32 / 16.8248.17 / 50.7445.81 / 47.503.61x3.44x
type-reflection10.16 / 12.6725.77 / 26.7123.43 / 24.262.54x2.31x
static-class-methods21.20 / 24.9061.60 / 63.2459.20 / 67.812.91x2.79x
abstract-interface14.97 / 24.2533.97 / 65.1831.34 / 49.562.27x2.09x
none-checks10.32 / 11.9527.62 / 33.3425.19 / 28.722.68x2.44x
linked_list4.86 / 5.749.20 / 11.056.92 / 8.571.89x1.42x
trees7.66 / 8.0511.86 / 12.569.57 / 10.321.55x1.25x
heap5.25 / 5.659.42 / 10.317.09 / 8.001.79x1.35x
graph6.24 / 7.4210.01 / 10.947.60 / 8.261.60x1.22x
lru_cache15.86 / 16.3625.23 / 26.7423.01 / 24.001.59x1.45x
expression_tree6.21 / 7.1011.07 / 12.908.80 / 10.201.78x1.42x
union_find9.79 / 10.4816.09 / 17.6613.69 / 14.801.64x1.40x
skip_list12.69 / 14.5520.05 / 21.0417.26 / 18.181.58x1.36x
trie21.48 / 28.8133.22 / 57.6530.66 / 44.271.55x1.43x
segment_tree8.78 / 10.3622.69 / 24.5420.17 / 22.362.58x2.30x

Plain workloads (14)

Geometric-mean speedup: 1.73x vs default CPython; 1.57x vs -S.

WorkloadRamanujanCPython .pycCPython -S .pycSpeedupSpeedup vs -S
assembler11.00 / 25.9819.53 / 52.5816.89 / 42.921.78x1.54x
expression_compiler24.55 / 26.2629.45 / 31.9326.93 / 28.311.20x1.10x
bignum18.24 / 36.1930.53 / 42.7228.00 / 56.171.67x1.53x
ntt19.90 / 21.7046.56 / 51.0144.22 / 49.522.34x2.22x
lz779.26 / 12.0518.36 / 23.6815.96 / 22.051.98x1.72x
sorting32.91 / 39.2947.88 / 75.6545.56 / 79.991.45x1.38x
dynamic_programming20.04 / 23.9127.50 / 29.3424.99 / 29.191.37x1.25x
graph_algorithms17.01 / 18.1328.64 / 30.1026.14 / 28.651.68x1.54x
number_theory57.82 / 61.5990.42 / 97.5886.10 / 88.211.56x1.49x
sudoku11.78 / 12.3720.87 / 21.5818.37 / 20.811.77x1.56x
nqueens8.25 / 9.0513.17 / 15.4310.75 / 13.091.60x1.30x
nbody12.66 / 27.1523.46 / 36.3220.78 / 32.061.85x1.64x
mandelbrot20.45 / 22.8948.99 / 53.0746.66 / 49.612.40x2.28x
heat_stencil24.13 / 30.9248.61 / 53.8646.15 / 48.452.01x1.91x

Peak physical footprint

Median MB from 100 interleaved fresh-process runs per workload and engine, measured with macOS /usr/bin/time -l. These are separate from the timing runs: CPython ran python3 X.py (source), and Ramanujan ran native X.pb <entry> 1. A ratio above 1 means Ramanujan used less memory.

Across all 34 workloads, the geometric mean of the CPython / Ramanujan footprint ratios was 1.63x; Ramanujan was lower on 32 of 34.

OOP workloads (20)

WorkloadRamanujan (MB)CPython (MB)CPython / Ramanujan
method-reuse1.915.342.80x
factory-return1.925.162.68x
polymorphic-dispatch1.955.202.66x
none-linked-list1.975.362.72x
bst-none-children2.505.642.26x
isinstance-dispatch2.025.142.55x
type-reflection1.975.172.63x
static-class-methods2.095.162.46x
abstract-interface2.035.142.53x
none-checks2.025.172.57x
linked_list3.725.661.52x
trees4.435.881.33x
heap4.205.621.34x
graph5.786.031.04x
lru_cache3.805.631.48x
expression_tree3.845.801.51x
union_find4.116.021.47x
skip_list3.865.951.54x
trie4.176.191.48x
segment_tree3.775.661.50x

Plain workloads (14)

WorkloadRamanujan (MB)CPython (MB)CPython / Ramanujan
assembler4.035.781.43x
expression_compiler4.695.851.25x
bignum4.345.821.34x
ntt3.895.551.43x
lz774.955.751.16x
sorting5.635.971.06x
dynamic_programming8.026.040.75x
graph_algorithms6.196.110.99x
number_theory6.206.731.09x
sudoku4.035.861.45x
nqueens2.415.412.25x
nbody3.705.611.51x
mandelbrot3.735.341.43x
heat_stencil3.165.501.74x

r/Compilers • • 1d ago

Fid : systems programming

Post image
0 Upvotes

Hi everyone

I've been working on my own programming language for some time, and I'm now looking for developers willing to test it, experiment with it, and provide honest feedback.

The project is called FID. It's a low-level, general-purpose programming language designed with several use cases in mind:

  • Systems programming
  • Embedded systems and electronics
  • Robotics
  • Operating systems
  • Software development
  • Server and backend development
  • AI infrastructure

I've taken considerable inspiration from Rust, but I wanted to explore a different approach to some of the challenges developers face when working with low-level languages.

Key features and design goals

  • Memory Safety: Compile-time memory safety checks without requiring Rust's lifetime system.
  • Built-in Security: Native capabilities-based permissions and an Effects system.
  • Native Performance: Compiles to native code without requiring a garbage collector.
  • Memory Management: Region-based memory management for greater control over allocation and deallocation.
  • Low-Level Control: Direct hardware access with an emphasis on safety and security.
  • Independent Compiler: Its own compiler, without mandatory reliance on LLVM.
  • Simplicity: Bringing together ideas from Rust, C, and Zig while exploring ways to reduce some of their respective limitations.

Compiler Architecture

FID is designed around an independent, modular compiler architecture, with a clear separation between the language frontend, compilation pipeline, optimization stages, and target-specific code generation.

The compiler is structured around several main layers:

  1. Frontend: Handles source-code processing, parsing, syntax analysis, and AST generation.
  2. Semantic Analysis: Performs type checking, compile-time validation, memory safety checks, lifetime inference, and Effects analysis.
  3. Intermediate Processing: Transforms and prepares the program for subsequent compilation stages, allowing the compiler to analyze and optimize code independently of the target platform.
  4. Optimization Engine: Handles compiler optimizations such as constant folding, dead-code elimination, inlining, and other performance-related transformations.
  5. Code Generation: Uses FID's own code-generation infrastructure to produce native executables without mandatory reliance on LLVM or an external compiler.
  6. Target Backend: Handles platform-specific requirements, including architecture, operating system, executable formats, and ABI conventions.

One of the main goals behind this architecture is to keep the compiler independent from external toolchains while maintaining flexibility across different platforms.

Current Development Status

The initial compiler was written in Rust. FID is a compiled language with self-hosting support, meaning it can compile its own source code.

The compiler is developed independently, and native compilation does not depend on LLVM.

The project is still in its early stages, so I'm not presenting it as a production-ready alternative to established languages. I'm looking for developers who enjoy experimenting with new technologies and are willing to challenge the design, identify bugs, and suggest improvements.

How You Can Help

I'm currently looking for 5 testers to try the language and share their experience.

If you're interested, you can:

  • Try the language and report bugs.
  • Share feedback about its design and features.
  • Suggest improvements or missing functionality.
  • Star the GitHub repository and follow our organization to support its visibility.

Links:

I'm particularly interested in hearing from Rust, C, C++, and Zig developers.

Honest criticism is more than welcome. I'd rather have people point out flaws in the design now than discover them much later in development.

To be clear, the language is still in its early stages of development and is not yet production-ready.

Thanks for reading!


r/Compilers • • 1d ago

Haze Programming Language

Thumbnail haze-lang.cc
0 Upvotes

r/Compilers • • 2d ago

Speed Demon II: a 48-hour race to make 26 interpreters fast with every JIT switched off

4 Upvotes

Speed Demon II is an online optimisation hackathon, 29 January to 1 February 2027. It is built around interpreters with no JIT: 26 languages, one pinned interpreter each. Plain PUC Lua instead of LuaJIT, the BEAM as the plain emulator, Guile with its JIT off, Emacs Lisp without native compilation. No FFI, native modules or subprocesses either.

So every speed-up has to come from the program itself, measured against a naive reference in the same language on one machine. Four tracks: parse 310,000 log lines, index 25,000 documents, join a hostile CSV, and run shortest paths on a 500,000-edge graph. Each push sets the team's car speed in a live 3D race round San Francisco.

Teams of 1 to 4. $2,000 in prizes.

Details: https://speeddemon.dev/2027/

Register: https://speeddemon.dev/2027/register/


r/Compilers • • 2d ago

[LLVM] Hexagon's instruction scheduler (V2) is now upstreamed

23 Upvotes

llvm PR#245961 has the implementation of Hexagon's instruction scheduler (V2) that Sergei and I developed.

We presented at the 2014 LLVM developers conference but not much was out there. After 12 years Qualcomm upstreamed it. If you work on DSP architecture, this might be worth a look.


r/Compilers • • 1d ago

SonicBoom 0.1.0 released - an AI compiler based on MLIR

Thumbnail github.com
0 Upvotes

r/Compilers • • 2d ago

Thoughts on safe-c

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 2d ago

PBScript

0 Upvotes

PBScript a basic for the web and end to end development with native purebasic. Mix of high level functions and full dom on typed interfaces. Create self hosting single exes or web pages.

Pbscript.org

And because it's Christmas

https://pbscript.org/pages/advent.html


r/Compilers • • 3d ago

Compiler Optimization Papers Is Now Up to 2025

Thumbnail github.com
138 Upvotes

Hi folks, quick update.

Over the past year, I've been collecting papers on compiler optimizations, spanning 1994 to 2025, and have added them to the papers-on-compiler-optimizations repo. I hope someone finds it useful :D

Feedback and contributions are always welcome!

-Fede


r/Compilers • • 3d ago

Multithreading for a Reference-Counted Language without Annotations

2 Upvotes

I'm working on "Bau" (link in a comment), a small, memory-safe systems language that transpiles to C. It uses reference counting and automatic borrow (most reads don't touch counts). Types declared owned have a single owner and no ref count, and are faster. I want to add multithreading support, and would like to get feedback on my design.

Goals

  • No annotations, lifetimes, Send/Sync, async. Any thread can read and write any object.
  • Memory safe, but data races are allowed, as in Java.
  • Single-threaded programs have no overhead; a small overhead for shared objects.

How it should work

  • Each object has a hidden shared bit in the ref-count field. Objects start local: non-atomic counts, as today. When an object is stored where another thread can reach it (global, channel, etc.), the shared bit is set in this and all referenced objects, recursively. I think this is like Lean 4. I know setting the bit can take time (same as freeing up a large graph recursively).
  • Shared objects use atomic counts, and atomic exchanges for pointer stores.
  • Borrowed reads stay count-free and lock-free. To do this, if the ref count of a shared object becomes zero, objects are not immediately freed, but only after a grace period, similar to Linux RCU.
  • Epoch based reclamation (EBR) is used. There are no safepoint polls (as in QSBR), but there is a bookkeeper thread that keeps track of the epoch and uses a process-wide barrier (membarrier).
  • Mutable owned objects move between threads. Storing them where several threads can reach them is a compile error. Types can be const which means all fields are immutable after construction; those can be shared freely.

Compared to...

  • Go: Go isn't memory safe under data races (torn interfaces and slices), and has a tracing GC.
  • Swift: uses atomic counts always, not only for shared objects.
  • Rust: needs lifetimes and Send/Sync, Rc, Arc. My language doesn't need those annotations.
  • Java: has the same safety contract, but uses more memory and has pauses due to tracing GC.
  • Lean 4, Koka: my language is primarily imperativ.

Disadvantages

  • Not data-race free: racy programs can give weird / wrong answers, as in Java. const types (which are opt-in) can prevent this.
  • Sharing is invisible: one store into a global can make a large graph shared, and slower.
  • close() of a shared object may run on another thread, a few milliseconds late. Or then, is bit slower (never borrows, and disallow owned).

Questions

  1. Is "memory safe, but not data-race free" the right trade-off for a simple language?
  2. Implicit sharing hides the fast/slow split. Would you prefer an explicit shared marker, or is tooling enough?
  3. Setting the shared bit is O(n). Can this be a problem?
  4. Has anyone shipped asymmetric fences (membarrier, FlushProcessWriteBuffers) in a language runtime?
  5. Is a non-deterministic close() acceptable for shared objects? Alternatively I could use refcounts here, always.
  6. What did I miss? Prior art I know: CPython free-threading (PEP 703), Lean 4, Koka, Linux RCU.

r/Compilers • • 3d ago

How did you stumble on compilers ?

8 Upvotes

as the title suggests , what made you or what situation pushed you to start working on compilers ?


r/Compilers • • 3d ago

BuildLang 2.0: Self-hosted zero-C systems & GPU compiler (5 shader backends, RNS-CRT GPU FP64, e-graph superopt certs)

0 Upvotes

Hi r/Compilers,

Over the past year I have been building BuildLang 2.0, an open-source, self-hosted systems and GPU compiler written with zero C runtime or C toolchain dependencies. I am sharing the architecture and design tradeoffs here and would genuinely appreciate technical critique from other compiler engineers.

Architecture Overview

  1. Zero-C 3-Stage Fixed-Point Bootstrap: The compiler self-hosts across native and portable backends (PE64, ELF64, RV64, and WASM) with direct object/executable emission and no dependency on libc or an external C linker. CI enforces cryptographic fixed-point convergence (Stage-2 == Stage-3 bit-for-bit, GAPS = 0).
  2. Explicit Effect Rows & Linear Disjoint Ownership: Functions declare effects directly in their type signature (performs {} statically proves mathematical purity: no I/O, no ambient global mutation, no nondeterministic clocks). Memory management combines Polonius-style CFG borrow analysis with Austral-inspired linear disjoint ownership (--strict-ownership), enforcing single-consumption invariants along every CFG path without GC.
  3. Single-Source SSA Shader IR (5 Backends + Subgroup Uniformity): Rather than splitting host code and device shaders across separate languages and header-padding conventions, a single .bld kernel lowers through a shared SSA Shader IR to SPIR-V (checked with spirv-val), WGSL, HLSL, GLSL, and MSL. Prior to emission, static SSA uniformity analysis verifies subgroup and workgroup barrier convergence, and host-device buffer structs are statically layout-checked across std140, std430, cbuffer, and scalar block rules. A bounded-fuel reference VM executes the same kernels on CPU (3.88M invocations/sec) to verify 0-ULP CPU/GPU parity.
  4. Certified E-Graph Equality Saturation & Superoptimization: Mid-end algebraic and bitvector optimizations run through bounded equality saturation over e-graphs, emitting machine-checkable rewrite certificates so aggressive instruction-combining passes do not silently introduce poison/undef mismatches.
  5. Fused GPU Ozaki-II RNS-CRT Exact Arithmetic: Because consumer GPUs heavily throttle hardware IEEE-754 FP64, we implemented fused Ozaki-II Residue Number System + Chinese Remainder Theorem (RNS-CRT) codegen targeting INT8 Tensor Cores (PR #432). On an RTX 4090, this path achieves 8.29x higher throughput and 120x tighter accuracy than native hardware FP64 by deferring rounding until final reconstruction.

Source & Technical Documentation

I would welcome feedback or hard questions on any part of the pipeline, especially around combining effect rows with linear capabilities across CFG joins, e-graph extraction cost models for GPU targets, or cross-ABI struct layout verification.


r/Compilers • • 3d ago

Horse64 Root: a system language similar to C/C++, reimagined with a focus on easy syntax, understandable OOP, and some baked-in safety features

Thumbnail codeberg.org
0 Upvotes

r/Compilers • • 4d ago

Need an internship badly

0 Upvotes

am a final-year undergraduate student from India with a strong interest in compilers and compiler development. I am actively learning and exploring this field and would love to gain some hands-on experience. I have interned once on MLIR and LLVM related project.

If there are any PhD students, faculty members, or professionals working in companies or research organisations who could guide me towards an internship opportunity or refer me to relevant openings, I would be extremely grateful.

I would be happy to share more details about my background and my resume if needed.

Thank you for your time and consideration!

Best regards.


r/Compilers • • 5d ago

CFG vs DFG

Thumbnail reddit.com
3 Upvotes

r/Compilers • • 5d ago

Memory emulation as an intermediate step in C++ to Rust translation

3 Upvotes

I'm experimenting with translating large C++ codebases like ROOT to safe Rust.

My current approach is to first translate C++ to run on a checked memory emulator written in Rust, then gradually remove the emulation using static analysis.

I tried this on ROOT's Minuit2 (around 14k lines of C++), and all 13 numerical tests produced identical output. However, only about 3% of the functions have been fully converted to ordinary Rust so far.

I'm wondering how far static analysis can actually take this approach. Is using memory emulation as an intermediate step a reasonable idea, or does it just make ownership recovery more complicated?

I'd also appreciate any suggestions for papers or existing work on similar approaches.


r/Compilers • • 5d ago

Releasing The Yugo Programming Language and Skopjemu Emulator

Thumbnail serjective.org
0 Upvotes

r/Compilers • • 4d ago

A lot of open source developers contribute to learn and shorter review time in VxLang helps.

Thumbnail github.com
0 Upvotes

With a new language and compiler implementation like Vx, there are just several dimensions of compiler design, programming language design, and runtime that a variety of curious PL folks would find interesting!

Review turnaround times are short and there is little wait between acceptance and merge. So if you are looking for interesting projects, check out the issue list linked below.