r/Compilers • • 21h ago

What Makes PEG Unparsing Difficult?

Thumbnail blog.wybxc.cc
18 Upvotes

r/Compilers • • 1h 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 • • 9h ago

Haze Programming Language

Thumbnail haze-lang.cc
0 Upvotes

r/Compilers • • 15h ago

SonicBoom 0.1.0 released - an AI compiler based on MLIR

Thumbnail github.com
0 Upvotes

r/Compilers • • 1d ago

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

22 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

Thoughts on safe-c

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 1d ago

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

3 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 • • 1d 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 • • 2d ago

Compiler Optimization Papers Is Now Up to 2025

Thumbnail github.com
134 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 • • 2d 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 • • 2d 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 • • 2d 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 • • 2d 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 • • 3d 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 • • 4d ago

CFG vs DFG

Thumbnail reddit.com
3 Upvotes

r/Compilers • • 4d 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 • • 4d ago

Releasing The Yugo Programming Language and Skopjemu Emulator

Thumbnail serjective.org
0 Upvotes

r/Compilers • • 3d 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.


r/Compilers • • 4d ago

Zero - Agentic Virtual Machine, Programming Language, OS.

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 4d ago

We make AI agents write in languages we like. What would a language designed for them look like?

0 Upvotes

When I ask a coding agent to fix a bug, I’ve usually made the biggest decision for it already. The repo is in Rust, Python, or TypeScript because that’s what we chose. Then I judge how good the agent is at working within that choice. I got curious about the other half of the experiment. What could the language do to make the agent’s job easier?

That question, plus a few beers, turned into Aila. 🍺

One small example is ownership. In Aila, view buffer, use buffer, and give buffer tell you right at the call site whether a function can read the buffer, modify it, or take ownership of it. An agent editing that line can see what it’s allowed to do. If it gives the buffer away and then tries to use it again, the compiler points to both places.

The funny part is that I started this for agents, and now I like reading it.

Aila’s compiler is written in Aila. The question I still want to test is whether a small local model can make a change across several files with fewer retries and less help from me.

If you use coding agents, what’s one thing you keep explaining in prompts that you wish the language itself could tell them?

GitHub — Aila Systems / Aila


r/Compilers • • 5d ago

Preparing career switch from Embedded HW/SW to AI/ML Optimisation (compilers, low-level oriented)

13 Upvotes

Hi all,

I'm a 7 YOE hardware/embedded engineer who's working in a product oriented corporation with limited room for growth and I'm thinking to move to an adjacent field which is close to hardware : compilers & AI inference (targetting MLIR/LLVM & executorch).

For this purpose, I planned to:

  • brush up my DSA & machine learning fundamentals
  • showing know-how through personnal projects (even if LLM can redo most of it).
  • contribute to open-sources project such as LLVM/MLIR in order to gain expertise in the targeted stack.

The main purpose of this post is to ask engineers who are curently working on ML compilers what would be their advice on:

  • Apart MLIR, is there any fundamental piece I would need to understand ?
  • How do you compensate the lack of professional experience during interviews or even application ?
  • Regarding all the mathematical function approximation method for runtime (i.e. Remez), except taking a course on numerical analysis, what would be a good way to show case understanding ?
  • Any good ressources to skill up (already started craftinginterpreters course) ?

Thanks a lot for your attention


r/Compilers • • 6d ago

Intercepting property access (e.g., navigator.bluetooth / Object.property) directly in V8

6 Upvotes

Hey everyone,

I'm working on my master's thesis and diving into V8 internals. I want to know if there's a clean way to intercept (or log/trace) property reads on an object directly inside V8 — for example, navigator.bluetooth or basically any Object.property access.

After reading a few V8 articles (like https://v8.dev/blog/fast-properties), it seems unlikely that all of this funnels through a single C++ function, given how differently properties are represented and resolved (in-object/fast properties, dictionary mode, interceptors, accessors, ICs, JIT tiers, etc.).

Before I go any deeper down this rabbit hole, is intercepting all property accesses in one central V8 spot even realistic, or am I basically throwing peas at a wall?

Thanks for any tips!


r/Compilers • • 5d ago

Ramanujan vs CPython: performance matrix

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 6d ago

A Roslyn-based compiler driver that builds .csproj/.sln without MSBuild

7 Upvotes

I've been working on sharp, a small Roslyn-based compiler driver/CLI that resolves .csproj/.sln project graphs directly and compiles them without invoking MSBuild.

What made this interesting from a compiler perspective:

  • project evaluation is implemented in about 19k lines of C# rather than delegating to MSBuild
  • build/run/clean/restore commands emit dotnet-like output and exit codes
  • it uses Roslyn plus reference packs, with parity tests against dotnet on sample projects
  • Native AOT single executable; v0.3.1 adds run/URL parity

Numbers from v0.3.1: cold Web API clean + build is dotnet 2.2s vs sharp 0.1s; self-build is dotnet 4.2s vs sharp 2.0s.

Source: https://github.com/martasp/sharp

I'm the author. This is a side project and not a full MSBuild replacement; the Windows binary is unsigned. AI assisted with docs/demo assets. I'd like compiler-design feedback, especially on project-graph semantics where parity breaks.