r/Compilers • • Sep 12 '26

Klyn 0.1.7

Post image
0 Upvotes

r/Compilers • • Sep 12 '26

Need some initial starting ideas

1 Upvotes

I want to learn about writing mlir passes and llvm basics ... I dont know what type of projects I can do ? please someone drop some ideas


r/Compilers • • Sep 11 '26

MLIR Project Lighthouse – Update

Thumbnail discourse.llvm.org
24 Upvotes

r/Compilers • • Sep 12 '26

Building an Ada Compiler with AI: The adac Experiment

Thumbnail reddit.com
0 Upvotes

r/Compilers • • Sep 11 '26

QueryBrew: System-Agnostic SQL-to-SQL Query Optimization

Thumbnail vldb.org
3 Upvotes

r/Compilers • • Sep 12 '26

C Compiler written in Java with help of Fable 5.1

0 Upvotes

For fun, I wrote a c compiler (non-optimizing) in Java targeting modern C (C23) using claude. I developed a c shell similar to jshell in java. The compiler also bundles a built in an assembler for x86. A linker is planned for end-to-end compilation. There is still a lot of work in progress but I wanted to share the project early for feedback. I spent around $400 in AI credits so far and it took over a week on and off of working on it.

I drive the architecture of the compiler and verify the AI implementation with a large test suite.

It can compile and run lua (all test passing) and curl (partially).

Cheers!


r/Compilers • • Sep 12 '26

IF per se I am creating a compiled programming language using QBE ir will some one take it and help me with llvm?

Thumbnail reddit.com
0 Upvotes

r/Compilers • • Sep 12 '26

Nytrogen - A low-level systems language with native quantum support

0 Upvotes

Nytrogen - A lowlevel quantum language Nytrogen is a low-level systems language with C-style syntax written in C++. Nytrogen focuses a lot on quantum computing alongside general purpose programming. The syntax is very straightforward and very readable its mostly C-style with the extra stuff of course. The architecture is also pretty modular which makes it very easy to update, and its (kinda) os agnostic with the standard library being written in C and the compiler's code generator not emitting any linux syscalls or linux specific stuff or thier equivalents on other operating svstems (I use arch btw). The quantum library (qlib) is currently built in assembly with some C++ wrapping which does mean it might not work on other operating systems but I am not really sure since I haven't tested it on anvthing else so far. Quantum programming in nytrogen includes having qubits and complex numbers as primitive types (and matrices are also coming soon). If you are interested in this project and wanna follow updates consider starring the github repo. And if you find any issues with the compiler, feel free to open an issue or a PR its really encouraged and would absolutely help. Github: https://github.com/X12-Cloud/Nytrogen


r/Compilers • • Sep 11 '26

Was muss ich lernen, um einen Compiler zu bauen?

0 Upvotes

Das bekomme ich wahrscheinlich nicht hin, aber zumindest mochte ich Compiler von Grund Auf verstehen.


r/Compilers • • Sep 11 '26

new programming language just got updated!

Post image
0 Upvotes

r/Compilers • • Sep 11 '26

Not another basic C calculator

7 Upvotes

Wanted to share my compiler that I am working on: mcc

Currently it can compile a very basic c program into x86_64 Intel assembly. It supports basic integer math with numbers and variables, and thus is a really simple calculator:

int x = 4;
int y = 3;

int main() {
  int a = 2;
  int b = 4;

  return (x + y) * (a + b);
}

Next I'm going to work on control flow with if if-else and while and then boolean logic. The project borrows ideas heavily from a university course I did about compilers, but the future scope plans to slowly add features until have a proper compiler that support the subset of C/C++ that my hobby OS uses.

Even further in the future, (no clue if this will even happen) I plan to abstract away a lot of it so that it becomes a M + N compiler, where it can cross compile one language to other. Obviously that is very far fetched and I am mainly just keeping that idea in my head so that I try to design a nicely abstracted compiler pipeline. I think the main push for this will be when the my hobby os decides to support more than one arch, which will be good encouragement to at least have multiple output languages.

AI Disclaimer:
Before you call it vibe-coded because of the quick succession of commits, I would like to state that none of the code in this repo is written by AI or AI tools. For learning, AI was used akin to google or stack overflow, with also some questions regarding best practices or design decisions - however I tried to keep as much of as my own design as possible.

See the wakatime activity log here which is the best proof that I can give that I really did spend 11hrs coding the project: https://imgur.com/a/mjQsJnp


r/Compilers • • Sep 11 '26

If you’ve used Enzyme, I think you’ll understand immediately why I built Catalyst for AI agents

0 Upvotes

If you’ve used Enzyme, or even just liked the idea behind it, this will probably make sense immediately.

One of the useful things about compiler-level differentiation is that you can take computation that already exists and ask a much more interesting question than:

“What does this code do?”

You can ask:

“Which inputs are actually driving the result right now, and in which direction?”

I built an open source project called Catalyst around that idea, but with the workflow designed so AI agents can use the information directly.

Imagine an agent working on a simulation with 20 parameters.

Reading the source might tell it what those parameters represent. It does not necessarily tell the agent which three are dominating the output at the operating point it cares about, which ten barely matter there, or which direction each one needs to move.

Catalyst can measure that.

So instead of:

“This variable looks important, maybe try changing it.”

an agent can get something closer to:

“These three inputs dominate the result here, these six barely move it, and this is the direction each one pushes the output.”

That creates a very different loop for an autonomous agent:

inspect → measure → decide what matters → change → measure again

For supported numerical Rust, C, and C++ code, Catalyst works from the LLVM IR produced by the compiler you already use. You do not have to recreate the calculation inside a separate ML framework just so an agent can reason about it.

And it does not simply produce a derivative and tell the agent to trust it.

Catalyst independently checks the result numerically. If the derivative and the separate check disagree, it refuses the result instead of passing a questionable number down the agent loop.

There is another side of Catalyst that I think is especially useful for coding agents.

Say an agent is fixing a local API that starts doing this under burst traffic:

POST /orders -> 503

A typical autonomous coding loop might look like:

reproduce → edit code → tests pass → declare victory

Catalyst can instead reproduce the failure, reduce it to a smaller scenario that still triggers it, preserve the conditions that caused it, generate held-out scenarios the candidate did not optimize against, then compare the old and new versions.

So the agent can end up with something like:

“The original burst-load regression is fixed. Five of six held-out scenarios pass. One still fails when the dependency becomes slow.”

That is a much stronger signal than “the test suite is green.”

The other piece I wanted was portability.

Catalyst can take a checked computation and export it as standalone Go or R, along with fixtures containing the expected behavior.

So one agent can analyze a computation, another system can run the exported version later, and Catalyst does not need to remain in the production application.

There are also derivative artifacts that carry the computation, validation information, provenance, and a SHA-256 digest chain.

That means an agent can hand one to another agent or machine, run it again at a different input point, and detect if one of the underlying files was modified along the way.

So the broader workflow becomes:

existing code → measure its behavior → identify what matters → verify the result → hand off something reproducible

For people who have used Enzyme, the familiar part is the value of getting derivatives from code that already exists.

What I wanted to add around that idea was the rest of the loop an agent needs: independent checking, provenance, reusable artifacts, structured agent tools, portable outputs, and a way to rehearse software failures instead of relying on the agent’s own confidence.

Catalyst also has optional AI integration, but honestly that is not the part I find most interesting.

The interesting part is giving your existing agent another kind of instrument.

Not another model.

Not another prompt layer.

A way to ask the program itself:

What actually matters here?

Repo:

https://github.com/lovettsendit/catalyst

For people building autonomous coding or engineering agents, where would you use this first?

Would you give an agent sensitivity information to help it decide what to change, use rehearsal to decide whether its change really worked, or combine both into the same loop?


r/Compilers • • Sep 11 '26

The Modulon Programming Language

0 Upvotes

(Looking for contributors)

Modulon is a very fast and lightweight AOT compiled independent language. Modulon is NOT a macro system. Modulon is designed for lightweight POSIX programming with the same exact power as C and C++.

https://github.com/roccohimel/Modulon


r/Compilers • • Sep 10 '26

Profundizar con libros educativos sobre compiladores en chile, tiene salida laboral?

Thumbnail reddit.com
0 Upvotes

r/Compilers • • Sep 10 '26

WasmBolt — The LLVM Project in your browser

Thumbnail anutosh21.github.io
2 Upvotes

r/Compilers • • Sep 09 '26

A language that feels like Java but compiles to native code

23 Upvotes

I’ve been working for some time on Ironwood and it would be nice to get some feedback from the community. Ironwood is a language that keeps the familiar Java syntax and object model but compiles ahead of time to native executables, without a JVM, JIT, or garbage collector. So it is very different than GraalVM. Basically GraalVM makes Java native. Ironwood makes native development feel like Java.

It already supports classes, interfaces, exceptions, generics, packages, and compiler-checked memory reclamation. It also deliberately leaves out features such as reflection, autoboxing, varargs, and threads.

This is the first public release, and the project is still early. I’d really appreciate feedback on the overall direction, especially which Java exclusions make sense and which would make the language impractical for you. I'm particular excited about the possibility of a Ironwood-to-Java transparent bridge, so that to execute native code from Java would be like... writing Java :)

The GitHub repo is here: https://github.com/ironwood-lang/ironwood


r/Compilers • • Sep 09 '26

What are your favorite "old school" code generators without AI? (e.g. Roslyn or Smithy)

8 Upvotes

And what are their benefits that keep being useful to this day?


r/Compilers • • Sep 09 '26

How much effort do compilers put into reusing stack frame space?

28 Upvotes

Registers are a constrained resource in a CPU, but are fast to read and write. Therefore, backend compiler writers devote a lot of time and effort to allocate variables to registers, using various heuristics like graph coloring to pack as many of the variables into the register file.

In comparison, stack space is relatively cheap, but slow. With some luck, locality of reference ensures that the "warm" part of the stack memory is cached.

My question is: how much work do compilers do to re-use stack slots for variables, if the variables concerned couldn't be placed in registers? For instance:

void foo(big_struct_t * pstruct1, big_struct_t * pstruct2) {
    big_struct_t copy = *pstruct1;
    frobulate(&copy);
    big_struct_t other_copy = *struct2;
    bazulate(&other_copy);
}

Here, copy and other_copy don't interfere. Would the compiler decide to allocate them on the same stack offset. Or does the compiler (writer) decide is it not worth the effort, and allocates the variables at different stack offset?


r/Compilers • • Sep 10 '26

An experimental C-like language with a different approach to memory safety (no GC, no borrow checker)

Post image
0 Upvotes

I wanted something that feels as simple as C while making memory bugs fail predictably instead of turning into undefined behavior.

That's why I started building hc2.

hc2 is a small experimental programming language with runtime-checked pointers. Every pointer carries its bounds, mutability, and allocation it belongs to. Out-of-bounds accesses, use-after-free trap immediately instead of silently corrupting memory. The cost is a few extra instructions per memory access.

There is no GC, no borrow checker, and no lifetime annotations. Rather than preventing these bugs at compile time, hc2 detects them when they occur and turns undefined behavior into runtime failures.

I'd like to hear your thoughts and feedback.

GitHub: https://github.com/hc2lang/hc2


r/Compilers • • Sep 09 '26

Why Construct Complex IR When You Can Inject Source?

6 Upvotes

While developing AET (Active Expandable Translator) on top of GCC, I came across an approach that I found surprisingly useful for implementing complex language semantics.

Normally, when lowering a language feature, we might construct the compiler's AST/IR programmatically:

complex semantics
      ↓
construct AST / TREE / IR

But there is another possibility:

complex semantics
      ↓
express the semantics as normal C code
      ↓
inject it into the existing frontend
      ↓
TREE → GIMPLE → RTL

For example, AET has an OO new$ construct. Its semantics include object allocation, initialization, MTCS information, constructor invocation, unref, and constructor failure handling.

Instead of manually constructing all the corresponding GCC TREE nodes, AET generates normal C code:

valueObj=({
    TFirst *_notv2_6TFirst0;
    unsigned int _mtcsPlatType0=0;
    int _isMtcs=((AClass *)TFirst.class)->isMtcsClass();

    _notv2_6TFirst0=
        TFirst.newObject(sizeof(TFirst),
                         _isMtcs,
                         _mtcsPlatType0,
                         "TFirst");

    _notv2_6TFirst0->objectSize=sizeof(TFirst);
    _notv2_6TFirst0->mtcsPlatformType=_mtcsPlatType0;
    _notv2_6TFirst0->_aet_magic$_123=1725348960;

    TFirst_init_object_2927145182(_notv2_6TFirst0);

    ((debug_AObject *)_notv2_6TFirst0)
        ->_Z7AObject10free_childEPN7AObjectE =
        _notv2_6TFirst0->_Z6TFirst22TFirst_unref_290629480EPN6TFirstE;

    TFirst *tempObject123=_notv2_6TFirst0->TFirst();

    if(tempObject123==NULL){
        if(_notv2_6TFirst0->objectSize>0){
            _notv2_6TFirst0->unref();
            _notv2_6TFirst0=NULL;
        }
    }
    _notv2_6TFirst0;
});

The important point is that this is normal C code. The semantics are expressed using the host language that programmers already understand.

AET then injects this generated source directly into the current GCC preprocessing/parsing pipeline instead of writing a .c file and starting another compilation:

cpp_push_buffer(pfile, (uchar *)nbuf, len, true);

The generated C goes through GCC's normal C lexer and parser, which constructs the corresponding TREE representation.

This gives me a useful separation:

AET parser / semantic analysis
          ↓
     semantic lowering
          ↓
      normal C code
          ↓
   GCC C frontend
          ↓
         TREE
          ↓
       GIMPLE
          ↓
         RTL

The key idea is not simply "generate C."

It is that source code is the language programmers use to express semantics, while AST/TREE/IR is the language the compiler uses internally.

For sufficiently complex semantics, I think the former can sometimes be a better construction language for the latter.

So why manually construct a large number of IR nodes when the same semantics can be expressed clearly in source code and handed to a mature frontend?

I'm interested in where others would draw the line between direct IR construction and source-level semantic injection.


r/Compilers • • Sep 09 '26

Cross-platform stack traces

Thumbnail marinohimself.ch
1 Upvotes

r/Compilers • • Sep 09 '26

A Proof-Of-Concept Cross Platform JIT Linker, Relocator & Memory Mapper handling Cross Platform W^X

0 Upvotes

So, welcome to the journey of continuing to explore the world of JITs.

This time, after a few months of experimentation with "How to write a damn good JIT Memory manager" I have finally decided to make a crate out of it.

The crate is called SaJIT - which is also a part of a VM project i am aiming at.

The crate is currently at v0.0.3 : https://crates.io/crates/sajit

The crate actually provides a slab memory manager in discrete multiples of 16MiB currently and manages those slab across Windows, macOS, Linux using RW-RX dual mapping for windows, linux and pthread_jit_np for macOS.

Also, i have ensured to keep as cross-architecture-compatible rather than locking to only x64, arm64.

I am looking forward to advices on how to improve it (with better abstractions for example, or better and detailed documentation)


r/Compilers • • Sep 09 '26

madc v0.99.2 released — madcide w/ GUI mode on Linux, Windows and macOS

Thumbnail gallery
0 Upvotes

r/Compilers • • Sep 06 '26

How to start learning compiler optimizations as a newbie?

55 Upvotes

I come with a background in computer architecture and embedded Linux. I was interested in ML systems and was reading up about it, and after going through several job postings and this link , noted that optimizing compiler code is a requirement. My questions are -

  1. Is knowledge of how compiler front end is written and IR code generated required to optimize them?
    https://engineering.purdue.edu/online/courses/tagged_items?q=compiler
  2. What's a good resource for compiler optimizations that can help in ML systems?

https://www.cs.toronto.edu/~pekhimenko/courses/cscd70-w18/docs/Lecture%201%20[Intro]%2001.11.2018.pdf

3) Are learning compiler optimization techniques the same for LLVM and MLIR? I don't see a lot of resources for MLIR compiler optimization. Is learning optimizations on LLVM helpful for MLIR and is learning LLVM not so useful for ML code optimizations ?

Thank you.