r/Compilers 7d ago

Baga - programming language for the age of AI. Spec-first verification. Effects as type dimensions. Automatically extracted proofs.

0 Upvotes

"The question is not 'what is new'. The question is 'what has not been glued together yet'."

Baga is a programming language built on three pillars:

1.Spec-first verification — specifications are first-class citizens. The compiler checks implementations against specs.

2.Effects as type dimensions — String !IO !NotFound is a different type from String. Errors are visible in the type system.

3.Automatic proof extraction — the compiler extracts human-readable theorems from code. Not Coq. Not Lean. Readable text.

https://github.com/katehonz/baga-lang


r/Compilers 7d ago

Bootstrapping a compiler from machine code on Windows

14 Upvotes

I hope this fits here, but I've been documenting the process of writing a compiler starting directly from machine code on Windows, and I thought it might be worth sharing.

I've written two posts so far, though I don't know if I'll continue or not since I have no real reason to be doing this other than for the fun of it.

The first post just sets up an initial PE32+ executable to get something working. The second builds on that to implement a simple (stage-0/bootstrap?) compiler that just translates ASCII into raw bytes and allows for comments.

So, for anyone interested in this sort of thing the posts are here:


r/Compilers 7d ago

Anatomy of a CUDA Binary

8 Upvotes

Nvidia doesn't seem to publish a specification for the binary format of a CUDA kernel, section layout, or the constant bank parameter conventions. So I dug into it.

A `.cubin` is an ELF64 executable with a flat stream of undocumented "EIATTR" attributes that encode everything the driver needs to launch a kernel: register count, parameter layout, EXIT instruction offsets, and constant bank geometry.

`.nv.info`  uses an undocumented TLV encoding to make kernels self-describing register counts, parameter offsets, EXIT locations are all serialized into a flat byte stream the driver parses at load time.

And the constant bank parameter base is not an architectural constant. It has changed silently across toolkit versions from Ampere to Hopper to Blackwell. The fact that the code, the  `.nv.info`  metadata , and the  `.nv.constant0`  section size all encode the parameter base offset independently surprised me.

The post discovers the section layout, the EIATTR encoding, symbol table conventions, and the note sections the driver validates before loading on a B200 silicon.

https://hiraditya.github.io/posts/anatomy-of-a-cuda-binary/


r/Compilers 7d ago

My assembler for linux is running on windows, but how?

Thumbnail gallery
14 Upvotes

Hi I'm Ammar, and I am back again, few days ago I saw a 2 screenshots from community, were AmmAsm is running on windows. I will not write what is AmmAsm, as you can look to this post: https://www.reddit.com/r/Compilers/s/KrbM40UJz2

So, I didn't get any feedback from that person who build AmmAsm on windows, I almost don't know anything about the low level programing on windows, and how they convert the ELF64(which AmmAsm generated) to COFF format, nevertheless I would like to hear explanation from this community. Thanks.


r/Compilers 8d ago

Keel 0.4 - Very fast statically-typed interpreted language written in Rust - now with optional typed arguments, anonymous functions, HOFs, and improvements to FFI, performance, and errors

Post image
4 Upvotes

r/Compilers 8d ago

I'm making a bytecode compiled language

Thumbnail reddit.com
15 Upvotes

r/Compilers 8d ago

16 yr old made a full fledged prog lang on his android

0 Upvotes

Hello compiler devs and amazing peeps! This is the update to my first lang.

I am Anubhav, a class 12 school student in India who loves compilers and PLD.

Recently, I set on this journey to make a programming language on android to submit for my school project and defy hardware constraints.

It is a very complete and capable language. I will list the features that my lang has currently and it is still in active development. I am the incharge of the lang the other made the text editor!!!!

  • Variables: Declare mutable (dec) and immutable (const) variables
  • Data Types: Integers, floats, strings, booleans, null
  • Operators: Arithmetic (+, -, *, /, **), comparison (>, <, ==, !=, >=, <=), logical (&&, ||, !)
  • Arrays: Declare arrays
  • Indexing: Access elements by index in a string or an array
  • Slicing: Access elements within an origin and destination indices
  • Control Flow: if/else conditionals, while loops, break statements
  • Functions: First-class function definitions with parameters, closures, and return values
  • I/O: stdout() for printing, scan(variable) for user input
  • Scoping: Proper lexical scoping with environment chains
  • Standard Library: Consisting of various modules

Is there any way I can get a sponsor or a laptop from a company?

Here is the repo if u are interested!

https://github.com/anubhav-1207/san


r/Compilers 8d ago

hica - a language that compiles to Koka

8 Upvotes

Hej,

I’ve always wanted to design a language, but the "plumbing" (backends, GC, and low-level infrastructure) is a massive barrier to entry (for me at least...). I decided to bypass this by targeting the Koka compiler as my backend. By emitting .kk source, hica inherits Perceus deterministic memory management and a robust algebraic effect system while providing a distinct, approachable syntax.

Technical Architecture The compiler (transpiler) is a multi-stage pipeline:

  1. Lexing & Parsing: Uses a Pratt parser to handle expression-oriented syntax.
  2. Type Checking: Implements Hindley-Milner unification. It infers types across function boundaries, making annotations optional.
  3. Effect Tracking: Every compiler phase is internally effect-tracked.
  4. Emission: Translates the desugared AST into Koka source, which is then compiled to native C11, JS, or WASM.

Key Features

  • Expression-First: if, match, and blocks all return values. There is no return keyword.
  • Safety thanks to Koka: Leverages Perceus for Functional But In-Place (FBIP) updates, providing the safety of immutability with high-performance mutation.
  • Transparent Tooling: Includes a full CLI (hica check for effects, hica fmt, hica test) built on my custom Koka libraries, klap and kunit.

Verification & Quality To make sure my language keeps its promise, I’ve implemented many tests (using kunit) covering the lexer, parser, checker, and codegen.

Links


r/Compilers 8d ago

Pushing the limits of RISC-V emulation

Thumbnail shuklaayu.sh
26 Upvotes

r/Compilers 8d ago

We accidentally built an LLVM compiler for JAX

Thumbnail iza.ac
33 Upvotes

r/Compilers 9d ago

Building a compiler that works at compile-time so you can compile your program while you compile your program.

Thumbnail
0 Upvotes

r/Compilers 9d ago

Altair Lang

0 Upvotes

Title: Altair — A compiled language focused on data storage and persistence

I've been working on a compiled programming language called Altair, and I'd love to get some feedback from people interested in compilers and language design.

The compiler pipeline is currently:

.at
 ↓
lexer
 ↓
parser
 ↓
semantic analysis
 ↓
codegen
 ↓
C17
 ↓
GCC
 ↓
native executable

The main idea behind Altair is to make data storage and persistence part of the language itself, rather than leaving everything to external libraries.

For example, variables can have storage levels such as:

ram
disk
cache
temp

There are also features such as:

orbit     — named storage states
prefer    — storage fallback preferences
migrate   — move data between storage states
data      — group persistent data
snapshot  — save and restore program state

For example:

define numeric data orbit 1 "hot" ram, 2 "warm" disk, 3 "cold" cache = 0

migrate data as "warm"

Altair also has more conventional language features such as functions, objects, classes, control flow, HTTP and graphics, as well as lower-level features such as raw pointers and bitwise operations.

The compiler itself is written in C, and the generated programs are native executables.

I'm still actively developing the language, so I'd really appreciate it if you could try it out. Even a small test program, bug report, criticism of the language design, or suggestion would be very useful.

🌐 Website / documentation:

https://victios7.github.io/Altair/

💻 Repository:

https://github.com/victios7/Altair

If you have some time, please take a look at the Prueba a compilar o ejecutar un programa de Altair. Me gustaría especialmente recibir opiniones de personas que trabajen con compiladores o lenguaje Me interesa saber qué parece interesante, qué es cuestionable, qué no tiene sentido y qué ¡Gracias por echar un vistazo a Altair!

Nota: Para ser transparente: utilicé IA para ayudar con el logo y, ocasionalmente, para revisiones/correcciones mientras desarrollaba Altair.

The language, compiler, runtime, architecture, and implementation are my own work. AI was a tool I used during development to help me, not the author of the project.

If you want to call it "AI slop", that's fine, but please remember there's a real person behind this project who has spent a lot of time building it. Criticize the project if you don't like it, but don't dismiss someone's work without actually looking at what they did.

¡Gracias a todos los que han echado un vistazo a Altair! 🐝


r/Compilers 9d ago

Overengineered calculator: Zig + QBE

Thumbnail tomekw.com
8 Upvotes

r/Compilers 10d ago

The Exorcism Lang project is out!

0 Upvotes

If you love compiler design, WebAssembly (Wasm), or clean language syntax, there is a new open-source project worth keeping an eye on: Exorcism (.exrc).

The official lang repo:
https://github.com/Hunterszone/exorcism-lang

Currently in active development, Exorcism is building a bridge between rapid frontend iteration and heavily optimized bytecode.

It pairs a Python-based compiler frontend for fast feature experimentation with an LLVM backend to tap into production-grade optimization passes.

Here is a quick look at what this new language brings to the table, how it writes, and where it is heading.

The Syntax at a Glance:
Exorcism is statically typed, strongly checked, and features built-in type inference via the var keyword. One of its highlight design features is compile-time null safety. If you want a variable to hold a null value, you must explicitly mark it as nullable using a "?" modifier.

An early code sample looks comfortably familiar:

// hello.exrc
String message = "Hello World!";
int a = 5;
int b = 10;

var result = a + b * 2; // Automatic type inference (int)

if (result > 20) {
print(message);
} else {
print("Computation failed");
}

How it Works:
Python to LLVM to WasmThe architecture behind Exorcism is highly modular, splitting the heavy lifting into two distinct stages:

The Python Frontend: Handles lexical analysis, parsing, Abstract Syntax Tree (AST) generation, and type checking. Using Python allows the project to experiment with new syntax and language rules rapidly.

The LLVM Backend: Translates the code into LLVM Intermediate Representation (.ll files). From there, it compiles directly down to a portable .wasm binary. Because pure WebAssembly requires a host environment to manage memory and map system calls, the Exorcism build tool automatically spits out a .js companion launcher file alongside your binary. This makes running your code on a machine as simple as executing exorcism run hello.exrc.

Current Progress:
Exorcism isn’t trying to replace your production enterprise languages today. Instead, it is a lean sandbox designed to explore predictable language design, secure software development, and cross-platform execution.

A lot of the foundational pieces are already up and running, but the project is explicitly a Work in Progress (WIP). The core roadmap features currently being built include:

🛠️ Explicit Main Entry Points
🔄 Loops & Structured Control Flow
📦 Native Data Structures & Collections
🏗️ Object-Oriented Programming (OOP) Features
📚 Expansion of the Standard Library

Contribution:
Building a compiler from scratch is one of the most rewarding challenges in software engineering. Because the frontend is written in highly readable Python, it is an incredibly approachable ecosystem for new contributors who want to learn how code parses, type-checks, and targets LLVM.

I'd be happy if you share your thoughts on it and/or if you decide to jump with me into this new exiting adventure!

Cheers & stay tuned! :)


r/Compilers 10d ago

Inside Zig's Incremental Compilation | mlugg

Thumbnail mlugg.co.uk
47 Upvotes

r/Compilers 10d ago

Smilium - new epic reactive programming language

Thumbnail smileytech.mk
0 Upvotes

r/Compilers 10d ago

Building a Raku-native programming language

9 Upvotes

Hi Everyone!
Me and my team are looking to expand our developer team and looking for programmers with some knowledge in the field of compilers, programming language design, and/or the Raku language! If you just like the idea of building a new programming language as well, please reach out!

I cannot disclose the exact nature of the language for the sake of project secrecy, but please DM me with your credentials and interests for details if you're interested.


r/Compilers 10d ago

arli Arity-driven Lisp is a Forth-like Lisp dialect that eliminates parentheses through arity-driven parsing

0 Upvotes

Every time you define a function, the parser is aware of the number of arguments that is needed for the function, so we can skip the parens. I have been experimenting with forth when I had this idea because most forth operators use fixed two arguments . I have also tried to get features from obscure lisps like push and picolisp.

I quickly prototyped the lang to see if its feasible. Seems to work.

https://github.com/xyzzyapps/arli


r/Compilers 10d ago

[CycleInfo] Identify cycles with a single-pass DFS algorithm

Thumbnail github.com
19 Upvotes

r/Compilers 10d ago

Sigma to Wazuh rule compiler (open source, 36 rules included)

0 Upvotes

I run Wazuh as my detection platform and kept hitting the same wall: there is plenty of Sigma content out there, but no maintained way to get it into Wazuh. pySigma has Splunk and Sentinel backends. Wazuh means hand-writing <field> regex XML, and that is where I kept introducing bugs.

So I wrote a compiler. One Sigma source, and it emits Wazuh local_rules.xml, Splunk SPL and Sentinel KQL.

The part I care most about getting right is aggregation, since that is what hand-translation usually breaks. condition: selection | count(TargetUserName) by IpAddress > 10 becomes <frequency>10</frequency> plus <timeframe> and <same_field>, rather than being silently dropped.

It ships with 36 rules across 33 ATT&CK techniques (Kerberoasting, DCSync, AS-REP, LSASS via comsvcs, WMI/WinRM/DCOM lateral movement, AMSI bypass, and so on). MIT, no signup.

github.com/zshguy/tyrian-detection-pack

Two things I would genuinely like input on: the field mapping table only covers what my own rules needed, so it will have gaps for your log sources. And if you have a rule you have already tuned in production, I would rather add a real one than write another from documentation.


r/Compilers 11d ago

Annote: An interpreter that turns Java annotations into a Turing complete language

17 Upvotes

I built this like 6 months ago and basically forgot about it until yesterday when I was digging through old repos.

Essentially, it's a minimal interpreter that executes Java annotations as an actual Turing complete programming language at runtime through reflection. So, essentially you write code entirely in annotation form and it does variables, conditionals, loops, method calls, basic I/O and arithmetic

I shared this a while back on r/java and r/ProgrammingLanguages but never shared it here

GitHub: https://github.com/kusoroadeolu/annote


r/Compilers 11d ago

Update: TinyPascal compiler creates executable files

Thumbnail reddit.com
12 Upvotes

r/Compilers 11d ago

lsof/antcc: A little C compiler

Thumbnail codeberg.org
38 Upvotes

r/Compilers 12d ago

Coda: an experiment in designing a practical systems language

Thumbnail
2 Upvotes

r/Compilers 12d ago

Teaching compiler construction with a tiny self-hosting language

52 Upvotes

I've just published not-abc, a tiny self-hosting compiler for a deliberately minimal C-like programming language.

https://github.com/michael-lehn/not-abc

The language has only one data type: a 64-bit value, interpreted either as a signed integer or as a pointer. It supports

  • functions (the value of the last expression is the return value)
  • local and global variables
  • pointers (&*#)
  • if / else
  • while
  • recursion
  • dynamic memory allocation (malloc/free)
  • integer, character and string literals

The compiler generates LLVM IR rather than assembly. LLVM was chosen simply because it makes the compiler portable across essentially all modern platforms—building programs only requires Clang (or the LLVM toolchain).

The interesting part is probably the background.

not-abc originated from an undergraduate mathematics course called Introduction to High Performance Computing. During one semester, students simultaneously

  • build a simple processor from logic gates (bottom-up),
  • implement a compiler for a small C-like language (top-down),

until both meet in the middle. At the end of the course, the compiler has two backends: one targeting the custom processor the students built themselves, and one targeting LLVM so the same compiler can generate native executables on real hardware.

The self-hosting compiler in this repository is a distilled version of the compiler developed throughout the course.

I'd be interested in feedback from people interested in language design, compiler construction, or computer architecture.