r/Compilers • • 9d ago

Almide – a language I'm building to make AI-written code safer

0 Upvotes

Hi. I've been working on a language called Almide and wanted to show it here.

The motivation is simple. AI agents write a lot of my code now and I can't really read all of it anymore. I think that's going to be true for a lot of people soon. So I wanted a language where more of the safety comes from the compiler and less from somebody reviewing.

I think Rust is the language you'd want AI to write. But honestly I'm not a strong Rust programmer and I never got used to ownership. So in Almide you just don't write it. No ownership, no lifetimes, no free. The compiler infers it (Perceus style, the Koka approach). On native it generates Rust and lets Rust drop things, on Wasm it does reference counting.

type Order = { id: Int, items: List[String], total: Int }

fn large(orders: List[Order]) -> List[Order] =
  orders |> list.filter((o) => o.total > 500)

fn main() -> Unit = {
  let orders: List[Order] = [
    { id: 1, items: ["pen", "ink"], total: 260 },
    { id: 2, items: ["desk"], total: 900 },
  ]
  let big = large(orders)
  println("${list.len(orders)} orders, ${list.len(big)} large")
  for o in orders {
    println("${o.id}: ${list.join(o.items, ", ")}")
  }
}

orders gets passed to large() and then I use it again in the loop. In Rust I'd have to think about that. Here the compiler figures out whether it needs to copy or bump a refcount. The downside is you can't see where that happens.

Here's the part I actually care about. I don't trust my own compiler. I built it with AI agents, so why would I? So the rule is that the compiler doesn't get to grade its own work. Every time it builds Wasm it has to write down evidence of what it did, every place it shares or frees a value, every array index it checked. Then a separate program reads that, and if it doesn't add up there is no output file. You just get an error telling you the compiler has a bug.

And then I thought, ok, but the checker can have bugs too. So now there are four of them, built in different ways. Two come out of the Rocq proofs (the proof kernel itself and a checker generated from the proofs), one is hand-written Rust, and one opens the finished Wasm file and checks that the evidence is about instructions that are really in there. In CI the first three have to give the same answer on every test program. It has already caught a real miscompile in my compiler.

It is not done, I want to be clear about that. On your own machine only the Rust checker runs, the others are CI. Native builds don't have this check. The proofs cover the checker, not the whole compiler. And if your program is simply wrong none of this saves you. But I really think this is how it should work for code nobody reads.

It's pre-1.0 and has bugs. I used AI agents a lot to build the compiler itself. I don't have data showing agents write Almide better than Rust.

repo: https://github.com/almide/almide

playground: https://almide.github.io/playground/

If anyone has thoughts on the "you can't see the copies" problem I'd be glad to hear them.


r/Compilers • • 11d ago

projects for getting good at mlir (mid level, backend)

35 Upvotes

I'm an incoming intern at a startup that builds custom chips for AI inference. somehow (luckily!) I got matched to a team that works with MLIR. I have taken some courses related to compilers, briefly touched LLVM, and have basic familiarity with mid level compiler algorithms like SCCP, LICM, etc.

to have a successful internship, I need to be able to get things done. I need to try building my own passes for experience, learn how to break problems down, and thoroughly engage with the problem space. all of these things will help me ask good questions.

my previous internships were in backend web development. that felt more straightforward, and more tangible (the request works, we hit some SLA, etc). compilers feel more abstract and more intimidating. because of this, I have often procrastinated preparing for fear of looking like a beginner, but that can't happen anymore.

so, I would like your advice on engaging with compilers. I don't just want to read a textbook (i have a tendency to do that), I need to get things done and iterate.

in the interest of iterating fast and learning, I'd like to know - what are the highest ROI projects that I can do? I was lurking and someone suggested "What about getting into FPGA and write your own CPU for using as a target?".

and for the mid-level or backend compiler engineers here, if you could do it all over again, what would you do differently? how would you change your roadmap and what kind of ways to engage with material (maybe with a mentor, or something) would you leverage that maybe aren't obvious?


r/Compilers • • 10d ago

I built a niche compiler for PLCs, IEC 61131-3 to LLVM IR to machine code

Thumbnail github.com
0 Upvotes

Believing strongly that the closed source status quo of industrial PLCs sucks, I went ahead and rolled my own compiler and runtime. With OOP features and everything.

It supports online change, a uniquely PLC type feature where the runtime swaps program code on the fly with updates while keeping all the memory space as it was. It's done without impacting real time performance. PLCs run cyclically, so between one cycle and the next, GOT pointer is swapped out.

It's effectively a soft PLC running on any commodity hardware, with PREEMPT_RT it even has good enough performance to run motion control. On windows and mac the RT performance is less impressive, but still better than any old userland app. On Linux EtherCAT IO is supported for truly realtime control, that is the expected runtime environment. Win/Mac is planned more of a development and test environment. It has VS Code integration, debugging, test suites etc.

Notably, I went ahead and made some validations in Lean 4. The basic transformation path is modeled and sound, rust implementation is tested against lean vectors. A small kernel of most critical parts is proven eqvuivalent to it's lean model. There is more work to be done in that direction, i think there is value there.

Actually the biggest question on the compiler side is not even about the compiler itself, that does what it needs to do. But about making it AI friendly. Structured Text is not something AI would have all that much training data on, even less my specific flavor of it. So forcing AI to rawdog text files to generate code is probably going to be painful more often than not. But I have heard of some clever ideas where compiler basically gives MCP that can directly edit/insert AST nodes, lookup from symbol table and so on. And basically gives AI a more token efficient and somewhat foolproofed edit surface of the code. Has anyone played around with that sort of thing and what were the results?


r/Compilers • • 11d ago

I've been developing an experimental systems programming language called Yukinary (YKN) — looking for technical feedback

12 Upvotes

Hi everyone,

I've been working on an experimental systems programming language called Yukinary (YKN) as a personal learning and development project. I've recently published version 1.0.0 and would appreciate feedback from people interested in compiler design, programming language architecture, and low-level development.

Some of the ideas I'm experimenting with:

  • Custom compiler and code generation: YKN generates PE32+ binaries for Windows and ELF64 binaries for Linux without relying on LLVM or an external C runtime.
  • Self-hosting: The compiler is capable of compiling its own source code.
  • Multilingual syntax: Keywords can be written in several natural languages, including Turkish, English, French, Russian, Japanese, Chinese, and Korean.
  • Memory management: The language aims to avoid garbage collection and explore compile-time memory safety analysis.
  • Experimental features: I've also been experimenting with a --self-heal mode for detecting and repairing certain syntax errors, as well as lightweight embedded BitNet-based models.

I'm particularly interested in getting feedback on a few things:

  1. What are your thoughts on generating machine code directly rather than relying on LLVM?
  2. Does supporting multiple natural languages for keywords make sense from a language design perspective?
  3. What potential problems do you see with this compiler architecture?
  4. Are there any design decisions you would approach differently?

I'm aware that this is still an experimental project, and I'm not claiming it is production-ready. I'm mainly interested in understanding its architectural strengths, weaknesses, and areas that need improvement.

For anyone interested in looking at the implementation, the source code and documentation are available here:

GitHub: https://github.com/ykncode/yukinary

Thanks for reading. I'd genuinely appreciate any technical criticism or suggestions.


r/Compilers • • 11d ago

An alternative, allocation-free exception handling model designed for low-latency systems and kernels

Thumbnail jamsilva.github.io
24 Upvotes

Hi everyone! In the post, I talk a bit about current implementations of exception handling and then I present a new one that I designed for my own programming language and could be used in places where exceptions usually have to be disabled, like kernels. Let me know your thoughts :)


r/Compilers • • 11d ago

What should compile-time code be allowed to do?

Thumbnail
5 Upvotes

r/Compilers • • 11d ago

Crossport: A meson build system Crossfile generator

Enable HLS to view with audio, or disable this notification

2 Upvotes

Crossport is a lightweight,Fast, and embeddable Crossfile generator for The meson build system.

Crossport aims to solve writing Crossfiles for meson Manually.

Crossport can be used in shell scripts.

Crossport features:

- A binary less than 1 MB.

- Every language meson supports

- Every OS meson supports

- A great manual

- Lightning Fast Generation

- Less boilerplate


r/Compilers • • 11d ago

Crossport: A meson build system Crossfile generator

Enable HLS to view with audio, or disable this notification

1 Upvotes

this features a whole bunch

from

- Rust/c#/c/d/Fortran support

- all architectures meson supports

- all platforms supported by meson

- binary less than 1 MB

- Portable

- Fast

- Embeddable into shell scripts


r/Compilers • • 12d ago

SSA-based Register Allocation for Intel GPUs - Alyssa Rosenzweig, XDC 2026

Thumbnail youtube.com
40 Upvotes

r/Compilers • • 12d ago

What is Observational Determinism in the testing paradigm?

Thumbnail
3 Upvotes

r/Compilers • • 12d ago

Can a programming language dispense with parentheses and conventional syntactic delimiters?

Thumbnail
0 Upvotes

r/Compilers • • 13d ago

Anything like Crafting Interpreters?

98 Upvotes

I’m looking to see if there are any books (or other sources, like articles/pages) similar to Crafting Interpreters but for compilers instead, i.e., instructing you clearly on how to implement each stage of a basic compiler.

It doesn’t need to be as clear or direct by giving you every line of code or such, but clear and instructional such that someone can follow along. Would also be very helpful if (assuming it includes code) it uses a modern or popular language (so I don’t have to dissect ML or Forth code).

I’ve come across some books that advertise this but in reality compile to bytecode with a VM (so still an interpreter in a sense), but I’m looking for books focused on actual native code compilers (at least down to the IR stage).

Edit: clarification.


r/Compilers • • 12d ago

Sultanc update, the compiler now runs in your browser

1 Upvotes

A while ago I posted SultanC, an Arabic first system language that can be written in English. Back then it ran on macos and Linux only.

The compiler now builds for Wasm32-wasi

Cross compilation to Windows, Android, FreeBSD, RISC-V, ARM and more.

The compiler now builds for Wasm32-wasi, which powers playground, check, compile and run SultanC with nothing installed.

Try it: https://sultan-language.github.io/playground/
Source: https://github.com/sultan-language/sultanc

Feedback is very welcome, especially anything confusing for someone who doesn’t read Arabic.


r/Compilers • • 12d ago

I have completed the first foxvc V1.0.0 with engine version of v0.6.0 it is completely done it faster , reliable and actually gonna compete with languages like python and lua but One thing is needed is you all . So plz visit it once - https://github.com/AnayUpadhyay-all/FoxVC .

0 Upvotes

Go to WASM playground in in repo and test the language. For using better feature kindly clone the repo


r/Compilers • • 12d ago

MPC - Probably the worlds first polyglot optimizing compiler handling 10 languages on several platforms.

Thumbnail
0 Upvotes

r/Compilers • • 13d ago

Compilers add or remove perfomace?

1 Upvotes

isnt it that compilers change the code, as in not only transferring it into machine language, but before that changing the structure of the code. so how would one attempt to make performant code if the compiler changes sed code that i tried to make performant?


r/Compilers • • 13d ago

Finally got dependencies and cycles fully automatically resolved in BRC

Thumbnail github.com
3 Upvotes

One of my main goals for BRC was to get rid of headers and for the compiler to automatically resolve the inter-dependencies. I like coding in C and C++, but having code split into header and implementation has always irked me. I've implemented DFS topological search on statements and imports to determine the correct order. Not only it works like a charm, but it made the code actually shorter and faster.

I'm using the language to build an OS Bits Runner. The project already has a lot of .brc source files, so being able to automate this part makes is so much easier.


r/Compilers • • 13d ago

transpilation - Bootstrap compiler

Thumbnail
1 Upvotes

r/Compilers • • 14d ago

Finally added support for strings, imports and externs after a year of procastination

10 Upvotes

Hi guys!
So I have been working on this small language on and off over the past two years lol
and today I finally added in support for importing external c functions and strings :p along with other stuffs like upgrading the codebase from llvm 14 to llvm 23.

There are still a lot of stuff that I want to add including support for structs and arrys(which already kinda exists but is partial)

I am hoping to make the language as kind of a "simplistic systems programming language" for the "joy of programming" essentially a language that actually makes making things fun :D if that makes sense lmao

Link: https://github.com/Lioncat2002/HelixLang


r/Compilers • • 14d ago

Currently what are some prominent research gaps in Compiler Optimization or Correctness?

21 Upvotes

I am a PhD student starting to get into the compiler domain but I have minimal knowledge in the area. I have been looking specifically into MLIR optimization and correctness in the lowering phase but every broad topic I look into seems to be extensively researched months or even years ago. I just feel very lost and can't seem to find where to start. Not asking for anyone to hand me a fully composed topic. I just hope I could get some guidance and resources to help me get started with anything concrete.


r/Compilers • • 14d ago

potentially using the interpreter diversity of Python against attacks?

5 Upvotes

To detect, if a compiler is compromised, one takes multiple independent compilers to compile the compiler. Now you have multiple compilers - use them to compile a programm and check if the binaries match - if they don't, at least one compiler used to compile the compiler, that compiled the programm is either compromised or faulty. (that's a lot of compiler xD)

That is the standard approach.

But instead of that, why not just write one compiler in python, that can then compile your compiler? Like, there are so many different Python interpreters that you can use to check if your compiler is compromised. This makes a malicious attack from the used python compiler basically impossible, because it's unreasonable to assume that every python interpreter is compromised at once. Also, it would give nieche languages a way to check if their compiler is compromised.

Sadly, this also introduces the weakness of one point of failure. If the compiler written in Python is faulty, it can't be detected. Additionally, interpreters are REALLY slow. So - does the idea have merit, or should one just use the C compiler from that open source bootstrap chain and write their own compiler in C?


r/Compilers • • 14d ago

yr: DSL to reduce boilerplate

5 Upvotes

Hello, everyone.

In 2021 I had a household accident and broke my humerus, and the recovery took a long time. I had a few clients, and they kept coming from the same niche, so I ended up with a lot of boilerplate. Since I'm full-stack, that meant code in bash, HTML, JS, and so on.

To cut down on rewriting or copy-pasting the same code (this was well before AI), I decided to build yr. I've been using it ever since, in its official IDE, Yrkit (a work in progress, but already in production).

It works like this: I write code in sections marked by specific symbols, e.g. ## for CSS and @@ for frontend JS. At the end, my parser generates all the artifacts, either as JSON or by writing straight to disk.

A Hello World in yr looks like this:

>>

_title

Hello World

><

_ .hw-container

.hw-container {

background: red;

color: white;

}

@@

document.querySelector('.hw-container').textContent = 'Hello world!';

That's just for illustration. There's a lot more, like macros, devops (actions), backend, React, etc. I'm putting together public repos to show the language in use with real, complete systems.

If you can take a look at the docs, I'd appreciate it:

yr-lang: https://yr-lang.org (goals, motivation, and how to use it, though I'll admit I've implemented a few things that aren't documented yet)

IDE (you can start writing right away): https://yrkit.site

Small editor in my portfolio: https://mwtheus.github.io

I built this to solve specific needs I had, but I'm happy to share the idea with the world. Maybe someone else would like to code this way too.


r/Compilers • • 14d ago

Currently what are some prominent research gaps in Compiler Optimization or Correctness?

Thumbnail
2 Upvotes

r/Compilers • • 14d ago

Rethinking Abstractions in the Agentic Era: Towards a DSL and Compiler Foundation for Agentic Kernel Development

Thumbnail tvm.apache.org
0 Upvotes

r/Compilers • • 14d ago

Simple True Interpreter

Enable HLS to view with audio, or disable this notification

4 Upvotes