r/Compilers • • 3h ago

Is ClangIR(CIR) better than raw LLVM IR?

3 Upvotes

Just found it, and it seems more easily to understand than LLVM IR


r/Compilers • • 3h ago

An IL2CPP decompiler

0 Upvotes

Hi there, im working on a apk to source decompiler tool chain with full game compiled and run smoothly on almost any IL2CPP Unity game apk/ipa. Actually i have done for almost 40 games top of market focus on hybrid casual even the liveops part. Some game with pairIP anti Frida and BeeByte Obf still can break. But im not sure about public the kit since i dont know how it will impact. The de-compilation process took 1 day for everage size game to 5 days on massive game with million lines of code decompiled with LLM support.


r/Compilers • • 6h ago

Has anyone implemented capability types for a programming language?

0 Upvotes

A recent news where NEAR AI reported that an attacker exploited a RCE vulnerability in SGLang exposing account details etc.

At this point it seems like we need a better way to program inference systems. As per Claude's research and SGLang's published RCEs this year share a pattern: Python features that run code by design, exposed to the network.

  1. Pickle over sockets. A ZMQ broker calls pickle.loads() on unauthenticated data, and one scheduler socket binds to 0.0.0.0 by default.
  2. Malicious model files. A GGUF chat_template can carry a Jinja2 template-injection payload because templates weren't sandboxed, and a torch.load(weights_only=False) fallback unpickles .bin files.
  3. Weak admin endpoints. LoRA loading allowed unauthenticated RCE through an incomplete pickle denylist, and /server_info returned API keys.

This is where *capability types* can help programmers and tools and AI reason about the attack surfaces. Vx is in early stages so adding capability types is not too difficult at this point but I'd like to learn from someone who has done it before.


r/Compilers • • 2d ago

Compilers always felt like black magic to me, so I started building one from scratch in C

28 Upvotes

Hey everyone,

For a long time, compilers felt like this intimidating black box that only seasoned wizards or PhDs could understand. Every time I looked at LLVM or GCC source code, I got completely lost.

A few weeks ago, I decided to stop being intimidated and just try building a tiny C99 compiler from the ground up to understand what actually happens between source code and machine instructions. I'm calling it mibicc.

I'm taking an incremental approach (inspired by Rui Ueyama's philosophy with chibicc), where every commit is an isolated, test-driven step.

I just hit Step 4, and it was the first real "aha!" moment for me:

  • Built a simple recursive descent parser that constructs an Abstract Syntax Tree (AST).
  • Handled operator precedence (*, / over +, -) and arbitrary nested parentheses.
  • Implemented a simple stack-machine code generator that emits AT&T x86-64 assembly using imul, cqo, and idiv.

Seeing an expression like 2 * (3 + (4 * 2) + 2) parse into a tree, emit assembly, and return the correct exit code on Linux felt incredible.

The code is still small and readable (~250 lines of C), and every step has CI tests on GitHub Actions. My goal is to eventually work my way through control flow, functions, and pointers.

I'd genuinely love any feedback, critique on how I'm structuring the AST nodes, or advice from people who've built compilers before on traps to avoid as I move toward local variables and statements:

Repo: https://github.com/mi-vault/mibicc

Thanks for reading!

Edit: Decided to add Windows support alongside Linux from the start (--target=windows and --target=linux). I'm on Windows so it felt silly to only generate Linux assembly and not run it locally. Also feels nice making it my own thing rather than just copying chibicc 1:1.


r/Compilers • • 20h ago

I got tired of Python-wrapped VMs, so I rewrote my language’s entire frontend in Pure C. Here’s what happened in FoxVC v2.0 & the 0.7.1 “Titan” update.

0 Upvotes

Hey r/Compilers !

 A while back, I started building FoxVC—a lightweight, zero-dependency scripting language and bytecode virtual machine designed around 25 deterministic keywords
 (act, emit, pick, alt, spin, pulse, etc.).

 Like a lot of hobby language projects, it originally started with a classic architecture: a Python frontend (lexer, AST parser, bytecode compiler) that called
 into a fast C VM (foxvm.so) via ctypes.
 It was fun, it worked, but eventually, I hit what I call the "3-language duplication trap":
 1. You write a feature in Python.
 2. You have to sync it with your C VM.
 3. Then you want a WebAssembly browser playground, so you end up maintaining a third JavaScript parser that slowly drifts out of sync.
 4. Worst of all: cold-start latency sucked. Spawning Python just to parse a 20-line .fox script took ~200ms before the C VM even touched the first bytecode opcode.

 Over the last few weeks, I pushed two massive updates—v2.0.0 (Engine 0.7.0) and today’s v0.7.1 “Titan” update—to completely overhaul the engine.


r/Compilers • • 2d ago

[CFP] CC 2027 (ACM SIGPLAN Int'l Conference on Compiler Construction): submissions due December 3, co-located with CGO/PPoPP/HPCA

6 Upvotes

The submission site for CC 2027 is now open, and the deadline is under two weeks away.

What: ACM SIGPLAN 2027 International Conference on Compiler Construction (CC 2027)

When/where: March 20-21, 2027, Salt Lake City, Utah, co-located with CGO, HPCA and PPoPP

CC is interested in work on processing programs in the most general sense: analyzing, transforming or executing input that describes how a system operates. Topics include, but are not limited to:

  • Compilation and interpretation techniques: program representation, analysis and transformation; code generation, optimization and synthesis; and their verification
  • Design and implementation of novel language constructs, programming models and DSLs
  • Compilers for modern, emerging or non-conventional domains: AI and deep learning frameworks, EDA toolchains, high-level synthesis, database engines, quantum computing, DNA computing
  • Compilers for modern, emerging or non-conventional hardware: specialized AI chips and accelerators, quantum hardware
  • Techniques, from programming languages to micro-architectural support, for secure, parallel, distributed, embedded or mobile environments
  • Run-time techniques: memory management, virtual machines, dynamic and JIT compilation
  • Programming tools: refactoring editors, checkers, verifiers, compilers, debuggers, profilers

Important dates (AoE):

  • Abstract (optional): December 1, 2026
  • Full paper submission: December 3, 2026
  • Author response: January 8-10, 2027
  • Notification: January 20, 2027

Also worth knowing:

  • Artifact Evaluation runs after notification, and papers that pass get a seal of approval. You are asked to indicate interest at submission time.
  • Up to 10% of accepted papers may receive a Distinguished Paper Award, and up to 10% of evaluated artifacts a Distinguished Artifact Award.

Links:

Happy to answer questions in the comments.


r/Compilers • • 2d ago

In a matmul (C=A@B), if A is in HBM and B is in SMEM, where should C go?

3 Upvotes

In case of GPUs, it is common to have operands in different memory, sometimes there are specialized instructions but the programming language may not provide the right tool to capture the optimization.

C = A @ B for example:

Most languages assume A, B and C are in the same memory. That keeps things simple, but it could have performance implications.

So if A is in HBM and B is in SMEM, where should C go? Typically kernel programmers use assembler, Ptx etc to have tighter control on the codegen.

But if we allow memory spaces (HBM, SMEM, registers) in a programming language's type system (like Vx), one can write better code without using lower level primitives.

Is it the right amount of control a language should provide or defer it to assembler/intrinsic. I have early design draft for Vx if anyone can give feedback. Link in comment


r/Compilers • • 1d ago

A C compiler in C whose IR is printed text, which the x86-64 backend parses back

0 Upvotes

I have been building a C compiler in C, about 14,000 lines with no dependencies. Two decisions in it are worth other people's opinions, and both are the kind you only get to make once.

The repo: https://github.com/IzonIcy/LumiComp

The IR is printed text.

codegen prints a textual IR to stdout. The assembly backend then parses that same text back to build its own representation.

Why: the IR stays diffable, golden tests are just text files, and codegen output can be read without a debugger. Every stage of the pipeline is a subcommand, and this is the decision that made that possible. You can run codegen and look at the result.

What it costs: the backend re-derives types from text instead of being handed a typed structure. It guesses from the operation and the operands, and three of those guesses were wrong before I found them. The IR carries less information than it should, and that is a real defect I have chosen to live with.

The backend does no register allocation.

Every value lives in a stack slot. Load, operate, store, for everything.

Why: the output is correct before it is fast, and the backend stays small enough to read. It is about 3,400 lines.

What it costs: the generated code is slow, and the backend cannot use the register count as a signal about anything. I think this is the right trade for a compiler meant to be read, but I would like to be argued out of it.

What it covers

Integers, doubles, pointers, control flow, function calls. The assembly backend rejects structs, local arrays, single-precision floats, sizeof, and more than six integer arguments, each with a located diagnostic. The front end is wider than the backend.

What I am asking

  1. If you have built a compiler with a text IR, did you keep it or move to an in-memory structure, and what made you move?
  2. Is there a version of "no register allocation" that stays readable but produces code someone would actually ship? A linear scan is maybe 200 lines, and I keep deciding not to.
  3. The preprocessor rewrites the program as text rather than as tokens, so source locations are approximate inside macros. Is that fixable without rewriting the stage?

Build log, one post per stage, each about one trade and one bug: https://github.com/IzonIcy/LumiComp/tree/main/docs/build-log


r/Compilers • • 2d ago

Pyrefly 1.5: 100% Conformance and 40% Faster

14 Upvotes

Link to release: https://github.com/pyrefly-org/pyrefly/releases/tag/1.5.0

Pyrefly (a Python type checker and language server) has just release version 1.5. It brings large performance optimizations and new features like Tensor Types six months after the first stable release.

Highlights (Taken from release):

  • 100% typing spec conformance. Pyrefly now passes all 146 test files in the typing conformance suite. Some of these fixes change how names in annotations resolve; see Behavior Changes.
  • Faster checks. v1.5.0 checks 40% faster than v1.4.1 and uses 9% less memory across the 71 benchmarks in Astral's ty_benchmark and the python-type-checking benchmark suites. (Tested on an M5 Max MacBook Pro with 18 threads.)
  • A new hint severity. Diagnostics that were previously IDE-only are now regular error kinds at a new hint severity: unused-import, unused-parameter, unused-variable, unreachable, and inactive-code (formerly unreachable-code). By default, they appear in your editor and are hidden from pyrefly check output, but you can configure them in pyrefly.toml, silence them with suppression comments, or promote them to errors like any other error kind.

r/Compilers • • 1d ago

I built Oster with AI – a memory-safe language with NLL borrow checking that compiles to portable C11

0 Upvotes

Hey everyone,

I’ve been working with AI on Oster, an experimental programming language and compiler written in Rust that compiles down to portable C11.

Why Oster?

The main goal is to combine modern static safety guarantees (ownership, non-lexical lifetimes / borrow checking, escape analysis, exhaustive pattern matching) with the ubiquity and zero-runtime portability of standard C11 — making it easy to target anything with a C compiler and integrate seamlessly with existing C codebases.

My repo:

https://github.com/kapimati/Oster

What it looks like

Here is a small snippet in Oster:

extern fn puts(s: str) -> i32;

enum Result { Err(str), Ok(i32) }

fn checked_div(a: i32, b: i32) -> Result {

if b == 0 { return Result::Err("division by zero"); }

return Result::Ok(a / b);

}

fn sum_divs() -> Result {

mut let total = 0;

for d in \[2, 4, 5\] {

total += checked_div(100, d)?;

}

return Result::Ok(total);

}


r/Compilers • • 1d ago

RCA v0.1.0-beta: a statically typed language with built-in tensors and autodiff, written in Rust (developed on a phone)

Thumbnail github.com
0 Upvotes

I've released the first public beta of RCA, a statically typed language with built-in tensors and automatic differentiation. The compiler is written in Rust and was developed on a phone in Termux.Features: type inference, generic functions, enums + match, modules, a bytecode VM, native codegen via Cranelift, CPU tensors, reverse-mode autodiff, and tooling (fmt, lint, LSP, REPL, debugger, package manager).

Not production ready. Known gaps: no references/borrowing, no generic structs, no GPU. Feedback on design and on the Cranelift backend is welcome.


r/Compilers • • 1d ago

Flame language

0 Upvotes

I want to get review of my (currently traspiled) language. It includes compiler and building system, minimal standard library. Its currently in development

Repo: https://github.com/TheFlameLang/Flame

Docs: https://flame-lang.mintlify.site


r/Compilers • • 3d ago

Is there any other compiler backend other than LLVM, MLIR?

27 Upvotes

I tried searching but maybe what i want doesnt exist. I want simple IR that has vectors(something like C++ vectors), struct fields and functions. Ik that too high level for ir but transpilation to C++ is slow to compile into final binary file. If anyone from you know if this kind of IR exists, i would appreciate to know about it. I use C++ for my compiler


r/Compilers • • 2d ago

optimistic or pessimistic compiler?

6 Upvotes

for those that compose and craft compilers, do you find the results better and more satisfying for you if the compiler you work on is permissive/optimistic or strict/pessimistic?

permissive/optimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating is probably ok but needs to pass some checks before translating to the target backend? (this is “the compiler is your friend” approach)

strict/pessimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating has something wrong and its job is to discover that wrong thing, and it is disappointed when the line passes all checks before translating to the target backend? (this is “the compiler is the teacher we’ve all had at one point in our life where they assume you’re going to do something bad as soon as they’re not looking” - and they’re not wrong)

obviously there has to be some balance here, but i’m curious, what has been your experience with these two approaches?


r/Compilers • • 3d ago

How good is Chez Scheme as a compiler backend?

7 Upvotes

Since my planned language is arguably too high-level (with GC and so on) to be simply implemented with LLVM/etc., I found that Chez Scheme is actually a backend for a few high-level languages like Racket and Idris.

How good is it?


r/Compilers • • 3d ago

A B compiler written in Haskell. Looking for code reviews.

Thumbnail reddit.com
4 Upvotes

r/Compilers • • 2d ago

I designed a Polish-prefix IR (pIR) and a pushdown-automaton logit masker so a tiny 100M 2-bit model emits 0% syntax errors and lowers to safe Rust

0 Upvotes

Repo: https://github.com/steveSujo/psudo

I built psudo as an exploration of an idea on my laptop. I have an NVIDIA GTX 1660 Ti with 4 GB of VRAM and limited RAM, so running frontier coding models locally is out of the question. Instead of seeing those limits as the problem—or renting cloud GPUs or vertically scaling my PC—I treated them as creative constraints. Asking a ~100M 2-bit ternary model (`TQ2_0`, 47 MB) to emit verbose surface keywords wastes half its context window. So I designed a tiny Python-indented surface DSL (`.psudo`) and split compilation into three pieces: 1. **Polish-prefix wire IR (`pIR`):** Humans (or an outer LLM) declare signatures and `@stub` directives in `.psudo`, while the local model emits bracketed Polish-prefix S-expressions (`f` for `fn`, `v` for `let`, `r` for `return`, `?` for `if`, `w` for `while`):

// Surface .psudo
fn clamp_val(val, lo, hi)
    if val < lo
        return lo
    if val > hi
        return hi
    return val

// Wire pIR (45-60% fewer tokens)
f clamp_val (val lo hi) [
  ? (< val lo) [ r lo ]
  ? (> val hi) [ r hi ]
  r val
]

Pushdown-Automaton Logit Masking (PirPdaConstraint): pseudo-engine runs a PDA over the 8,192-token BPE vocab and masks out structurally invalid tokens before sampling, guaranteeing 0% syntax errors at decode time.

  1. **Borrow Checker & Zero-**unwrap() Rust Lowering: Verified .psudo lowers deterministically into safe Rust with zero .unwrap() or .expect() calls and compiles via cargo.

Rough edges & honest trade-offs:

  • Grammar masking != semantic intelligence: out-of-distribution prompts still emit syntactically valid pIR with wrong logic, so ~15-line atomic stubs are the sweet spot.
  • All source lives inside a single binary capsule (psudo.bin) so outer coding agents don't bypass psudo synth by hand-editing files (--reveal-code "the slow pink elephant" unlocks raw inspection).

Would love any blunt feedback from compiler folks on the pIR encoding, the PDA masking approach, or the Rust lowering pass!


r/Compilers • • 4d ago

[Hiring] GPU Compiler Engineer – Intel Graphics Compiler (LLVM), Santa Clara, CA (hybrid)

44 Upvotes

Hi r/Compilers,

My team at Intel is hiring a full-time **GPU Compiler Engineer** in Santa Clara, CA (hybrid: part on site, part remote). We build the LLVM-based compilers behind Intel GPUs, used for AI, HPC and data-center workloads.

**What you'd work on**

- Compilers for OpenCL, OpenMP, C for Metal and SYCL / Data Parallel C++

- New compiler features, and code generation and optimization for Intel GPU architectures

- Finding and fixing performance bottlenecks, together with the hardware and architecture teams

- Tooling and automation (Python/shell, CMake, GitHub, Jira) on Linux and Windows

**Minimum qualifications**

- A Master's in CS, CE, EE or a related field plus 3 years of experience, **or** a PhD (completed or expected by May 2028)

- Strong C/C++

- Compiler development: optimizations, front-end translation and back-end code generation

- Computer and graphics architecture

**Nice to have**

- LLVM experience (a big plus)

- GPGPU programming models

**How to apply**

Email **hou-jen.ko@intel.com** with your resume attached as a PDF. Please use exactly this subject line so your application doesn't get missed:

`[GPU Compiler Engineer] Your Name`

A few lines on the compiler work you're proudest of (projects, papers, upstream LLVM patches) are very welcome.

Thanks!


r/Compilers • • 3d ago

The Chromagraph Challenge

Thumbnail reddit.com
1 Upvotes

r/Compilers • • 3d ago

Have you tried using AI to detect edge-cases when designing language features?

0 Upvotes

I use it daily and it's fantastic for detecting problems that the human eye might miss. In particular, I use Copilot to review my PRs.


r/Compilers • • 3d ago

How curiosity about building my own programming language led me to build a museum of miniature virtual machines in Rust & D

Post image
0 Upvotes

Hello everyone!

It all started simply enough: I was just curious about how to build my own programming languages.

That curiosity led me to explore assembly, which naturally led to writing bytecode interpreters, and step-by-step, I ended up building a whole collection of custom virtual machines.

Since I couldn't find a clean "museum" repo of VM samples to cross-compare with or PR share my own samples, I built one: Friendly-Virtual-Machines.

What's in the repo?

Every VM in the collection is built from scratch with zero external dependencies and stays under 7,000 lines of code. They all include custom assemblers (with symbol table label resolution), CPU state handlers, and native benchmark suites.

• Rust Samples: 5 register-based VMs, 1 memory-to-memory VM & 1 stack-based VM exploring different design patterns.

• D Sample: My latest addition—a register-based RISC-style VM written in D with a custom text assembler, hitting a performance gap of just 5.66x to 17.70x compared to native compiled code.

• Modular Design: Each VM is in its own isolated folder with clean separation of concerns.

• Mimicks Real CPUs: Since I was also learning ARM64 newly, most register-based VMs are heavily inspired from ARM/RISC designs.

• Design Diversity: Some display pure hardware emulation on hex codes; some display OOP-style polymorphic ISA design; some display High-Level Assembly (HLA) or Intermediate Representation (IR); some display ultra-fast Function Pointer Dispatch Table; some display assembler & text parser too.

The best part? Because they are lean and self-contained, everything compiles and runs smoothly right on mobile Termux. And I am consistently adding more samples to it as I learn & build more.

Looking for Reviews & Contributions!

I'd really appreciate feedback from folks experienced in systems programming, compilers, or VM design—whether it's reviewing my dispatch loops, pointing out architectural trade-offs, or suggesting ways to optimize further.

If you'd like to contribute your own miniature VM sample (in Rust, D, JS, or any language that runs cleanly with zero dependencies), PRs are completely open! Check out the CONTRIBUTING.md in the repo for the exact guidelines.

🔗 GitHub: Friendly-Virtual-Machines


r/Compilers • • 4d ago

Automatic Checking of Compiler Correctness with E-Graphs

Thumbnail stng.substack.com
25 Upvotes

r/Compilers • • 4d ago

Performance of a formally-verified C compiler vs. gcc -O2

Thumbnail ut-infraai.github.io
22 Upvotes