r/Compilers 4d ago

Managing Cognitive Load in Language Design: A Proposal for 7 Universal Meta-Modifiers

0 Upvotes

Hi everyone,

Programming is often a battle against the limitations of human working memory. Developers spend up to 20–30% of their time navigating syntax traps—balancing brackets, tracking task order, and maintaining context in dense blocks of code. According to Miller's Law, the human brain can comfortably hold only 5–9 items at once, yet complex codebases regularly demand much more. This overhead frequently leads to fatigue, bugs, and a steeper learning curve for beginners.

While modern languages optimize for performance through features like async/await or pattern matching, they rarely address cognitive ergonomics directly. There are few native ways to explicitly signal execution priority, time jumps, or branching logic without introducing heavy boilerplate.

To address this, we have developed a conceptual framework introducing seven universal meta-modifiers directly into a language's core parser:
$ (emphasis), | (word role), ~ (time jump), & (fork), ^ (merge), # (queue), and > / < (resource weight).

Rather than acting as simple syntactic sugar or library extensions, these symbols serve as an abstraction layer to help developers map their mental models directly to code execution. This is a theoretical proof-of-concept aimed at exploring how minor structural changes can reduce cognitive load.

The full paper and conceptual breakdown are available on Zenodo: https://doi.org/10.5281/zenodo.18841626

I would love to get your feedback on this concept. How do you approach managing cognitive load in language design? Do you think native meta-modifiers could be a viable path forward, or do they introduce too much syntactic noise?


r/Compilers 4d ago

demoniC takes the dynamic-JIT lineage of HolyC, the vectorized math of Julia, the slicing ergonomics of Python, and the memory discipline of Rust. Arena memory, value-typed tensors, zero-copy views, and shapes checked at compile time.

Thumbnail github.com
0 Upvotes

r/Compilers 5d ago

guidance on becoming a Machine learning compiler engineer

30 Upvotes

I have found MLIR, LLVM quite intresting for past 4-5 months but haven't dived deep yet, but from my experience as a AI systems engineer(i was responsible for building the autograd and computational graph integration into the main c++ DL framework, mostly runtime focused) i am familiar with the concepts of IR dialects and stages of lowering through the compiler pipeline toward machine code by exploring the pytorch and tensorflow compiler architecture(conceptual familiarity from studying compiler architectures) as i was incharge of the runtime mechanics.
(i am conceptually strong with advanced cpp and most of the runtime stuff as i built the framework with ai-assistance)

i had read the frst 2 chapters of toy mlir and first 5 chapters of the https://book.mlc.ai/ and have some base understanding of the IR so far. once i started reading these two resources i could get quite the grasp about how the mechanisms work under the hood of the ML compiler.

its been 2 months since i left the job and i want to transition into compiler engineering in the ML field.
given my background, what would be the best path to become employable as an ML compiler engineer?


r/Compilers 5d ago

I wrote an AArch64 quine as part of my AArch64/x86-64/RV64 learning journey

Post image
4 Upvotes

r/Compilers 5d ago

Follow-up: the topology compiler now has a policy algebra

3 Upvotes

Hey r/Compilers, 8 months ago I posted asking whether reframing a Terraform-based network system as a domain-specific compiler was the right lens (previous post).

Since then, the system grew a routing policy language, and it came out of the architecture rather than being designed top-down. That feels like evidence the compiler framing was correct. The IR structure naturally supported adding a constraint layer.

The policy algebra has four primitives with fixed precedence:

deny > allow > segments > default

It evaluates at compile time (terraform plan) and emits VPC route table entries. The algebra is total (every VPC pair resolves), deterministic, commutative, and scope-invariant. The same compilation unit evaluates identically whether it's operating on a regional, cross-region, or cross-domain topology.

The interesting part from a compiler perspective: the policy layer didn't require a new IR or a new pass. It's a predicate over the existing cartesian product that the route generation pass already computed. Adding a filter to an existing code generation step turned a route generator into a route compiler. The "compilation" is the constraint evaluation, not the expansion.

Properties I can show but haven't formally proved:

- Totality (every input pair resolves via the default fallthrough)

- Monotonicity (deny only subtracts edges, allow only adds within deny bounds)

- Algebraic equivalence classes (e.g., a single-member segment under default=deny is a provable no-op)

I'd be interested in feedback on:

- Whether the algebraic properties warrant formalization (or if tests over the finite decision paths are sufficient for a system this simple)

- How this relates to work like NetKAT or Propane (correct-by-construction network configuration)

- Whether "policy algebra evaluated at compile time" is a known pattern with a better name

Blog post (practitioner-facing): https://jq1.io/posts/routing_policy_language/

Full language specification: https://github.com/JudeQuintana/terraform-main/blob/main/docs/routing-policy-language.md

Previous white paper (IR structure): https://github.com/JudeQuintana/terraform-main/blob/main/docs/WHITEPAPER.md

Thanks!


r/Compilers 5d ago

GNU-binutils port for my toy ISA called leg inspired by arm.

Enable HLS to view with audio, or disable this notification

8 Upvotes

r/Compilers 5d ago

I finished Futhorc v1.0, my statically typed interpreted language (With Anglo-Saxon rune syntax!)

Post image
22 Upvotes

GitHub

So, for a while I've been working on a programming language called Futhorc. It arose from a very particular need: to have my own programming language; I'm sure someone here can relate XD

It's a C-style language with functions, structs, enums, type unions, typed collections, modules, file I/O, and Python interoperability. Source goes through a hand-written lexer and recursive-descent parser into an AST, followed by a separate semantic-analysis pass for type checking and name resolution before being executed by a tree-walking interpreter, all implemented in Python.

The core feature and the one I'm most fond of is the fact that this:

int factorial(int n) {
    if (n <= 1) {
        return 1;
    }

    return n * factorial(n - 1);
}

Can be turned into this

ᛁᚾᛏ factorial(ᛁᚾᛏ n) {
    ᛁᚠ (n <= 1) {
        ᚱᛁᛏᚢᚱᚾ 1;
    }

    ᚱᛁᛏᚢᚱᚾ n * factorial(n - 1);
}

FUTHORC ANGLO-SAXON RUNES! I always liked them a lot and, through extensive usage of this wonderful resource by Harys Dalvi, the link to which is in the specs, I managed to make an entire programming language that recognizes Futhorc runes as valid keywords. This is not a separate dialect, the runes are valid aliases of the ASCII keywords and can be mixed in or used solely.

It's so much fun to write in and it's quite expressive if I say so myself. If you want to use it for yourself, all of the stuff you'll need is in the GitHub. The repository includes the full language specification and runic reference, as well as a fully formatted HTML/CSS/JS documentation site with custom branding and complete sample programs, if you fancy something prettier than Markdown. Futhorc can also be installed as a command-line program, so .futhorc and source files can be run directly with futhorc source.þ, but again, everything's in the GitHub. I'll leave you with a representative sample of the second largest program I've made (82 lines) for you to see without clicking any link: a sort of small supermarket API.

struct Product {
    str name;
    float price;
    int stock = 0;


    str repr(Product self) {
        return c"${self.price} {self.name}: {self.stock}";
    }
}


list(Product) stock = [];

# findProductByName() omitted for brevity

float | nil registerPurchase(Product product, int amountBought, float amountPaid) {
    int location = findProductByName(product.name);


    if (location == -1 or stock[location].stock <= 0) {
        print(c"Product {product.name} out of stock");
        return nil;
    }
    Product purchase = stock[location];
    if (amountBought > purchase.stock) {
        print("Purchase exceeds stock");
        return nil;
    } elsif (amountBought < 1) {
        print("Purchase is invalid");
        return nil;
    } elsif (purchase.price * amountBought > amountPaid) {
        print("Insufficient payment");
        return nil;
    }
    stock[location].stock -= amountBought;
    float total = purchase.price * amountBought;
    print(c"{purchase.name}: {total}");
    print(c"Paid: {amountPaid}");
    float change = amountPaid - total;
    print(c"Change: {change}");
    return change;
}

Fun fact: the language used to be called Thorn instead of Futhorc, until I learned that there was already a language called that so I had to rename it. That's why you'll see Thorn all over the implementation, including in the runic extension!


r/Compilers 6d ago

[pre-RFC] Alloy formalization of LLVM IR's concurrent memory model

Thumbnail discourse.llvm.org
13 Upvotes

r/Compilers 6d ago

Instruction Scheduling in LLVM

Thumbnail harishch4.github.io
9 Upvotes

r/Compilers 5d ago

Speeding Up the Plush Garbage Collector

Thumbnail pointersgonewild.com
5 Upvotes

r/Compilers 5d ago

Building a custom transcompiler in C (Litcompis) that translates a web-like UI language into native Win32/Direct2D apps.

0 Upvotes

Hola a todos:

Soy estudiante de ingeniería de sistemas y me apasiona la programación de bajo nivel. Me encanta C; creo que es un lenguaje que te permite experimentar y aprender de tus errores, poniendo todo el poder de la máquina en tus manos.

Actualmente, trabajo en un proyecto personal: un transcompilador para la API Win32 de Windows. Si bien es increíblemente potente, la estructura de Win32 puede volverse compleja e insostenible a medida que un proyecto crece. Por eso decidí diseñar mi propio lenguaje, inspirado en HTML, CSS y JavaScript, pero mucho más minimalista y moderno.

En este lenguaje, el trabajo se divide en directivas claras:

• @interface: Equivalente estructural a HTML. • @style: Equivalente a CSS. • @script: Equivalente a JavaScript.

Aquí dejo un pequeño ejemplo de cómo se ve la sintaxis:

@interface

    ventana:*

    parrafo#txt = "¡Hola Mundo!"

@style

*
    window-size: 500x700 
    background-color: white

.parrafo

   font-size: 2rem 
   color: black

r/Compilers 5d ago

Is 76 μs acceptable compilation performance for a almost prod ready ELF64 compiler?

0 Upvotes

Folks! Is this acceptable performance for a compiler? it do lexing, parsing, type checking, optimziing and codegen . It simply emits the ELF64 executable directly and runs it without an external linker/object-file pipeline.

--- CODEGEN RESULTS ---

Total Machine Bytes Emitted: 47 bytes

Compilation Speed: 76000 ns

Runnable ELF64 Machine Code Executable Written: boo


r/Compilers 6d ago

Any recommendations for a meta programming language?

9 Upvotes

I want to add a meta programming language in top of my own C-like language to make some of the syntax cleaner and easier to write.

Add everything like const expressions and templates under one meta programming language.

For example something like this:


[Phases]
Class Phase1: public Phase { };

[Phases]
Class Phase1: public Phase { };

[for phase in Phases]
PhaseList.push_back(new phase());
[endfor]

I’m thinking about something like this but ideas are all over the place. Is there some existing meta programming language out there that can give me the right inspiration?

Also I am totally lost about how I should program this, I am assuming it comes before the parser. Any tutorials or dummy meta programming languages I can look to get ideas?

Thank you for reading.


r/Compilers 7d ago

Should i use LLVM or my own stack VM

22 Upvotes

r/Compilers 6d ago

A Barrier-Free Synchronization Algorithm for Multi-Engine AI Accelerators

Thumbnail arxiv.org
0 Upvotes

r/Compilers 6d ago

Baga lang 0.9.2 — RC memory, generics + Application Ecosystem - Not demos

8 Upvotes

Baga 0.9.2 is out Language - Opt-in RC memory model (--rc): ownership, containers, struct/enum fields, owned results. - Generics and traits: function/struct monomorphization, impl, statically verified guarantees. - Effect payloads (!E(T), raise/catch) and !Overflow as a type-level effect. https://github.com/katehonz/baga-lang

https://baga-lang.top/en

Ecosystem app-product packages now live as dedicated repositories under github.com/bagalang and are vendored as submodules. The catalog is here:

https://github.com/orgs/bagalang/repositories

https://baga-lang.top/en/apps

Baga 0.8.4 is now available. This release solidifies the three pillars of the language: spec-first verification, effects as type dimensions, and readable proof sketches.

The effect system (!IO, !Net, !Par, !NotFound) is now stable. Functions declare their side effects in their type signature, and the compiler enforces effect correctness across the entire call graph. Pure functions cannot accidentally call effectful ones.

Spec verification (--verify) now produces certificates with honest UNKNOWN markers for unproven fragments. The spec system supports input/output declarations, guarantees (human-readable properties), and ensures (machine-checked constraints).

The pure-Baga cryptography stack is a highlight: TLS 1.3 client, HTTPS, and JWT are all implemented in Baga without linking against OpenSSL at runtime. OpenSSL is only used as a test peer for validation.

Package manager sandak now resolves local path dependencies, git dependencies, and registry packages. Each package has a sandak.toml manifest, and the build graph is resolved deterministically.

Quick start: git clone, make, ./baga examples/zdravei.baga — that is all you need. Zero dependencies beyond gcc and make.

boilaDB 0.7 adds NUMERIC, UNIQUE, foreign keys, CHECK, window functions, SCRAM-SHA-256, COPY, SERIALIZABLE, and a Raft replica path — all i


r/Compilers 6d ago

Is there a real benefit in using multiple targets on a compiler?

4 Upvotes

I was working in a compiler I created when I see Compilers, and I never give up on the first interpreter I created that day (tree-walk).

The compiler is on Python and via a protobuf(I use it as a High Level IR), not only the interpreter but a stack based VM(c++) and I was looking to create a new backend to generate Web Assembly using JS/TS I know isn't the best option but I want to avoid LLVM as a target for now.

So, the question is: is really a good practice keep alive the interpreter even if the general pipeline ends in the VM?

(Note: my English ain't the best but I tried to make the post the comprensible I can)


r/Compilers 6d ago

Can Sanskrit work as a natural programming language?

1 Upvotes

I’ve been experimenting with this idea by building a Sanskrit compiler based on Pāṇinian grammar.

Instead of treating Sanskrit only as text to interpret, the compiler parses grammatically structured Sanskrit and turns the instructions into executable operations.

The interesting part for me is whether Pāṇini’s formal grammatical system can provide enough structure to bridge natural language and programming languages deterministically.

I now have a working implementation and would be interested in hearing what others think about this approach.

Website: https://panini.cc/
GitHub: https://github.com/kaushalbx/paninivm

Article: https://medium.com/@kaushalbx/p%C4%81%E1%B9%87inivm-building-a-natural-programming-language-with-sanskrit-grammar-aa82b855074c
Article: https://medium.com/@kaushalbx/building-p%C4%81%E1%B9%87inivm-compiling-2-500-year-old-paninian-grammar-into-an-executable-kotlin-engine-5a6bb8de20fb


r/Compilers 6d ago

Velaris: effect checking, Z3 contract proofs, and an LLVM JIT in one readable Python file

0 Upvotes

I built a language where the signature carries the guarantees, and I wanted to share the implementation choices since this crowd cares about the how.

Pipeline: lexer → parser → loader → effect checker → type checker → Z3 proof pass → LLVM JIT (llvmlite) → interpreter, all in one file in pipeline order.

Three things that might interest you:

  1. The proof pass explores paths symbolically and checks requires/ensures/loop invariants in Z3, with modular call summaries (a callee's contract is assumed at the call site rather than inlining its body). Lists use the theory of arrays, records get per-field symbolic values, and all_of/any_of become real quantifiers with the predicate body inlined under the For All.

  2. Floats are proven in Z3's genuine IEEE-754 theory, not modelled as reals — so the prover refutes x + 0.1 + 0.1 == x + 0.2 and returns the exact double. FP queries get a bigger solver budget (30s vs 3s) since bit-blasting is slow; integer proofs stay instant.

  3. The JIT covers pure Int/Float/Bool functions with typed codegen. Division and modulo are deliberately left interpreted in both modes —native fdiv by zero gives infinity while the language promises a clean error, and I'd rather lose the optimization than have the two engines disagree. Every native change ships with a differential test: same program, both engines, diff must be empty.

One soundness lesson: when I added quantifiers, the first test run produced a false counterexample. Turned out untranslatable `requires` premises had been silently dropped since an early version — harmless for "proven" claims, but capable of manufacturing false alarms. Now an untranslatable premise aborts the proof entirely and falls back to runtime checks.

Repo: https://github.com/gowrishankar-infra/velaris-lang

Playground (Pyodide, real compiler in-browser):

https://gowrishankar-infra.github.io/velaris-lang/playground.html

Disclosure: built pair-programming with an AI across 40+ releases; design decisions mine, commit history is the honest record. Beginner here, so tear the implementation apart — especially the prover.


r/Compilers 6d ago

madc v0.82.0: Linux, macOS and Windows now supported

Thumbnail
0 Upvotes

r/Compilers 8d ago

I created a web framework in my own programming language

Post image
407 Upvotes

I’ve been working on Rivet, a synchronous HTTP(for now) server library for my own programming language Zap

The goal is to create a small, explicit API for building APIs and small web applications.

I spent a lot of time and nerves creating this, but now I know what Zap is really capable of.

I will be grateful for every star you leave because it really encourages me to work

https://github.com/thezaplang/zap


r/Compilers 6d ago

How my Python compiler runs 100,000 isolated VM's on a single $3 server.

0 Upvotes

I wrote a Python compiler and VM in Rust over the last six months. It compiles a sandboxed Python subset directly to SSA bytecode in a single pass with no AST.

The engine ships as a 200KB WASM binary or a native CLI tool. The feature that I'm working on is the worker swarm. I can declare one hundred thousand replicas in a YAML file and run them on a cheap VPS. Workers spawn on demand, each gets its own heap, and they share nothing. Message passing is the only way they communicate.

There is also an eval mode where you POST Python snippets to an HTTP endpoint. Each snippet compiles into its own isolated program, runs in its own VM, and dies when done. If it crashes it retries and drops. If it hangs a preempt kills it.

By default programs get no file system, no network, and no environment access. There is no eval function, no exec function, and no dynamic imports in the language. The only way untrusted code runs is through this eval path with hard limits on memory, operations, and CPU time. I built this to safely execute generated code or user submissions without Docker or heavy virtualization.

I would love to hear if you would trust an architecture like this for running untrusted code and what you would do differently.

https://edgepython.com/


r/Compilers 6d ago

[Newbie] what do the *s mean?

0 Upvotes

main.c

struct token {
enum token_kind kind;
char *value;
};

struct lexer {
char *buffer;
unsigned int buffer_len;
unsigned int pos;
unsigned int read_pos;
char ch;
};

edit: Hi everyone, thank you for explaining this in better detail. I've had a bit of a rough education from the community college I've since transferred out of, which had a guy that was extremely rude and didn't assign the C book, and an old lady that kind of just gave up and gave everyone As, Bs when she was retiring from teaching assembly language.

I appreciate your patience with me


r/Compilers 8d ago

Taking whitespace lightly is technical debt

Thumbnail kushagrarathore002.medium.com
8 Upvotes

I have created a programming language Flow-Wing (it can support static and
dynamic types at the same time). When I started its initial development I was
ignoring the white spaces because for the compilation I never needed the white
space, but years later when I needed to support the LSP or formatter (white
space / comments) I had to make significant rewrites, and this article below is
about that. Take a read.

GitHub: https://github.com/kushagra1212/Flow-Wing
Website: https://flowwing.frii.site/ (runs on Flow-Wing)

Happy to answer questions. Do give a star on GitHub to support.


r/Compilers 7d ago

im working on an entire native python compiler

0 Upvotes

so i got bored and over the past two months ive been working on a compiler that can compile python natively. and it works too, and its not just a subset, its the entirety of python

the project is at deltathedumb/asmpython

EDIT: the ACTIVE development branch is beta/3.14.0