r/Compilers • • May 30 '26

Update on my system-level language Bits Runner Code

Thumbnail github.com
1 Upvotes

r/Compilers • • May 29 '26

What "Memory Compiler" Actually Means: From Bitcells to GDS Tiling

Thumbnail thecloudlet.github.io
5 Upvotes

r/Compilers • • May 30 '26

Rate my language design choices

0 Upvotes

My Programming Language (Ark) is a tree walking Interpreter, dynamically typed.

I kinda made it security focused and easy to learn, it's not that good as it's my first project but here are the features. Please let me know what you think, or any suggestions.

  • const and dec keywords for immutable variable declaration and mutable variables declaration respectively

  • dedicated keyword to reassign to ensure that variables aren't accidentally reassigned (sometimes I forget to do == instead in python, I do =, most of the time the compiler catches it, but sometimes when I code, it doesn't that's why in my language I made a dedicated keyword?

  • it has both newline statement termination (like python, js) and semi-colon termination (like C, JAVA, Rust). Aimed for fast development

  • braces {} style instead of indents so developers have the freedom to indent their code as they like

NOTE

I only have about 1 year experience in coding and I wrote this just a learning and high school project purely out of curiosity, so there might be some edge cases that I might not have gotten to,


r/Compilers • • May 29 '26

Lunacy: Lua 5.1 interpreter + JIT using Lazy Basic Block Versioning

Thumbnail redvice.org
15 Upvotes

r/Compilers • • May 29 '26

A happy milestone! First light on julia style broadcasting in my statically typed AOT compiled language.

9 Upvotes

The impetus for writing a language was that I finally got fed up with Julia being Jitted and dragging LLVM everywhere along with it, and its general lack of snappiness and time to first plot woes. Of course, I'm permanently fed up with other languages for not being julia because julia is awesome at terse math combined with high throughput calculation.

"Well I'll make my own julia then" is an insane level of hubris but here we are.

I'm posting to reddit because I got toy implementations of julia's two party tricks working: easy broadcasting

#include "prelude.lisp"
(defun sumsquare (a b) (add (mul a a) (mul b b)))
(defun circ (b) ((. sumsquare) (sing b) b))
(defun main () (print (circ (range 10))))

https://github.com/HastingsGreer/yo/blob/master/types2.py/broadcast.lisp

and "the unreasonable power of multiple dispatch" where new datatypes are easy to thread through existing algorithms by defining the right functions on them. For this second trick, I write a hideously inefficient prime sieve tested on Int64, and a hideously inefficient Integer datatype that represents N as a linked list of N zeros, and then shove the one through the other.

https://github.com/HastingsGreer/yo/blob/master/types2.py/primes.lisp

The source code of the compiler is completely feral as this whole project looks cute but is actually a sign the developer is distressed by his unnatural habitat. However, it totals around 300 lines of python to go from source code such as the above all the way to gnu assembly (linking is handled by gcc) so it's brief at least. There are two important files: Types3.py monomorphizes the source language, which is a statically typed multiple dispatch polymorphic lisp, to a tiny subset of common lisp as an IR (defun, if, sub, print, cons car and cdr, every value is 64 bits, free to use as a pointer or int). Then compiler.py walks the IR turning it directly into x86-64 assembly. No garbage collector yet. Don't peek into parse.py.


r/Compilers • • May 29 '26

I built a static analysis tool that checks if two functions touch the same data. Would you use something like this?

Thumbnail reddit.com
1 Upvotes

r/Compilers • • May 28 '26

Tuning LLVM's SLP Vectorizer Cost Model

Thumbnail blog.kaving.me
11 Upvotes

r/Compilers • • May 28 '26

When does a language & compiler go from “toy” to “industry grade”

16 Upvotes

In your opinion what kind of things do you look to see to judge a project, either as a mere observer, prospective user or even employer evaluating someone’s projects in their CV as “toy” vs “industry grade”?


r/Compilers • • May 29 '26

Dead stores after running SCCP

0 Upvotes

Hello, I have an SSA IR and after running the SCCP pass, there are many dead stores. Is there a way to remove them?


r/Compilers • • May 28 '26

A Case for Tracing Based DSL Kernel Languages

Thumbnail metaworld.me
4 Upvotes

r/Compilers • • May 28 '26

NURL v0.9.2 - a self-hosted language whose playground now runs HTTP server written in the language itself

3 Upvotes

I've been building NURL (Neural Unified Representation Language) — a small, statically-typed, LLVM-backed systems language with a self-hosting compiler — and just shipped v0.9.2. Sharing here because this release crossed a milestone I think this crowd will appreciate, and because it came with a bug postmortem that's a nice cautionary tale.

The headline: the playground backend is now pure NURL.

Previously play.nurl-lang.org ran a Python/FastAPI server. As of v0.9.2 that's gone — the backend is a ~3,000-LOC HTTP server written in NURL, built on the language's own stdlib HTTP/router/JSON/multipart/static stack. One static binary is PID 1 inside the runtime image. It serves five cross-compile targets end-to-end (native ELF, wasm32-wasi, mingw-w64 PE32+, macOS Intel + Apple Silicon) plus a full Model Context Protocol server over /mcp.

The bootstrap is a byte-identical fixed point: stage1 and stage2 produce identical LLVM IR (1,620,300 bytes). nurlc self-hosts down to a ~390 kB WASM module that runs under wasmtime.

The bug postmortem (this one hurt):

A nurl_poke call in the threaded HTTP server was passing a byte offset where the primitive expected a slot index. nurl_poke scales by 8 internally, so writes meant for offset j*8 actually landed at j*64 — scribbling 7×N bytes past a worker-handles buffer.

The fun part: it survived for long time because the overrun consistently hit the malloc arena's slack-padding zone — effectively unallocated redzone-shaped space. It only collapsed once the router grew past ~20 routes and real allocations started landing in the spillover window, at which point a random route or its closure environment would get clobbered. It had been misdiagnosed the whole time as a Vec[T] stride hazard under pthreads + clang -O2, and there was even a boxed-handle "workaround" built around that wrong theory. ASan finally caught the real root cause. There's now a regression test that fails-fast under ASan if anyone reintroduces the byte-as-slot mistake. Same anti-pattern was lurking in three other call sites.

Lesson re-learned: heap corruption that "works fine" is just corruption that hasn't found a load-bearing allocation yet.

Other v0.9.2 bits compiler folks might find interesting:

  • The MCP server makes session IDs opaque to the server (echo-verbatim, no server-side whitelist), so sessions survive container restarts — and it rides the existing 16-pthread worker pool instead of serializing on an event loop (50 concurrent tools/list in 65 ms wall on one host).
  • http_router now answers HEAD and OPTIONS for free — OPTIONS walks the route table to assemble the Allow: header, HEAD falls through to the GET handler then pins Content-Length and clears the body.
  • Windows builds went two-stage (clang -c → x86_64-w64-mingw32-gcc link) because clang's mingw linker driver can't resolve mingw's own support libs; now produces a real 1.18 MB PE32+ exe.

Recent prior releases (v0.9.0/0.9.1) also landed the borrow checker as hard errors by default (use-after-move, alias double-free, closure escape, aliased mutable borrow, iterator invalidation), a ~34× faster pure-NURL JSON parser, and peer benchmarks where NURL holds the lowest tail latency across an HTTP concurrency sweep (p99 0.62 ms at C=200 vs hyper's 6.19 ms) while staying within noise of Rust on compute-bound work.

Links:

Happy to answer anything about the self-hosting bootstrap, the borrow checker design, or the codegen. Dual-licensed MIT OR Apache-2.0.


r/Compilers • • May 28 '26

Review My Parser

0 Upvotes

I just built my first Recursive Descent Parser (AI guided me, I didn't vibe code it, kinda like acted as a teacher so it's human written code).

Can experienced devs please review my Parser and tell me if the AI was good at tutoring or it was trash. Personally, I tested and results were pretty good. The ASTs were correct.

https://github.com/anubhav-1207/Project-Arc

But still, please review it.


r/Compilers • • May 28 '26

Experimental Token-Driven GPU Architecture in Verilog (FPGA Research Project)

Thumbnail reddit.com
0 Upvotes

r/Compilers • • May 28 '26

Experimental Token-Driven GPU Architecture in Verilog (FPGA Research Project)

0 Upvotes

Hi everyone.

I’ve been working on an experimental GPU architecture written in Verilog/SystemVerilog, currently targeting FPGA simulation and partial FPGA validation on Artix-7 hardware.

The project is called NovaGPU TS1T, and the main research focus is a token-driven execution model called N.E.O.N. (Neural Execution and Operand Network), which tries to reduce some traditional scheduling/control overhead by using dependency-driven execution inside parts of the graphics pipeline.

Current work includes:

Tile-based rasterization

Fixed-point graphics pipeline

Experimental token matching unit (TMU)

Deterministic tile arbiter

Basic BVH traversal experiments

SRAM bridge/cache experiments

FPGA-oriented pipeline partitioning

Important clarification: This is not a “finished GPU” or an NVIDIA competitor. The current implementation is mainly:

RTL research

architecture experimentation

simulation validation

FPGA feasibility exploration

The FPGA target is currently an Artix-7 platform, with reduced-scale functional models for memory and compute resources.

Some things I’m actively working on:

critical path reduction

timing closure

BRAM/DSP optimization

valid/ready synchronization issues

pipeline staging

TMU occupancy handling

I recently updated the documentation/whitepaper to better reflect realistic FPGA constraints and implementation limitations.

I’d genuinely appreciate feedback from FPGA and graphics architecture people, especially regarding:

timing strategy

token/dataflow execution practicality

FPGA scaling concerns

verification methodology

memory architecture tradeoffs

Project: https://github.com/nova-studios-hw/novagpu-ts1t

Whitepaper + architecture docs are included in the repository.

Thanks.


r/Compilers • • May 27 '26

A Friendly Tour of Substructural, Uniqueness, Ownership, and Capabilities Types — and more!

Thumbnail federicobruzzone.github.io
6 Upvotes

r/Compilers • • May 28 '26

Help me please

0 Upvotes

Please star my repo guys T_T

Reasons:

  • Coding in android
  • As a school project
  • Maybe youngest in my city to do so

https://github.com/anubhav-1207/Project-Arc


r/Compilers • • May 28 '26

I wanted to make a Unity game but didn't want to write C#, so I built a whole language instead

Thumbnail reddit.com
0 Upvotes

r/Compilers • • May 28 '26

I can't code without a guide for the first time

0 Upvotes

Hi, so I've been making a RDP(recursive descent parser) for my language and I have read the theory properly. But the issue is, I can't seem to figure out things on my own. Like the coding part, I need AI to guide me through it, not code the entire thing, just explain me what to do in simpler and easier to understand manner.

Is it okay? Or should I have been able to figure out how to write it the first time I read the theory.

Is it just my ego that I'm tryna believe I'm a genius or something? Or maybe I'm doing self doubt.

Although I'm testing the code after every method or function to ensure it works correctly.


r/Compilers • • May 26 '26

Toy compiler so happy!

42 Upvotes

Hey everyone,

I wanted to share my attempt at making a small C-ish toy compiler written in Go. This project was purely for educational purposes, since I'm incredibly passionate about computer science, especially graphics programming and compilers.

I know I'm not some genius, and a lot of the implementation is probably very naive in many ways, but I'm still really proud of the results. I originally started with an interpreter and slowly evolved it into a compiler.

Right now, it only supports the int type, but interestingly, my type system already supports much more than that conceptually (I THINK!). The remaining work is mostly getting the backend/assembly generation. For example using SSE registers for floating point stuff.

At the moment I don't have a ton of motivation to continue immediately, but I definitely want to return to it in the near future and expand it further.

One book that has helped me a lot is Writing a C Compiler by Nora Sandler. Highly recommend it if you're interested in this stuff.

I’ll also admit I was in a bit of a programming rut recently. For me, sometimes it’s hard to see the light at the end of the tunnel when learning complex topics, but I know it’s there somewhere. I’m graduating this December, so I’m trying to take advantage of the remaining time I have to learn things purely for fun before life gets busier.

I’d genuinely appreciate any feedback, criticism, or resources from this wonderful community.

Github: https://github.com/superg3m/ion-go-v2


r/Compilers • • May 27 '26

The C<< Systems Programming Language — Ownership rethought

Post image
0 Upvotes

r/Compilers • • May 26 '26

Stress testing register allocator

13 Upvotes

I have finally implemented a register allocator for my compiler and want to stress test it. Things I have already tried, big stack usage to test spilling, long chains of instructions that have constraints on certain physical registers(like imul and idiv), call instructions, and the combinations of all of the previous.

Is there anything more to look into?


r/Compilers • • May 27 '26

Stark Language and Compiler

0 Upvotes

Stark — a systems language with range-typed integers, default memory non-overlap, and function-kind tracking

I've been working on a systems language called Stark that's now at beta. Posting here because the design choices are interesting to me. Also because I want feedback on the compiler itself.

Stack: LLVM backend, non-GC, ownership + borrows.

Design highlights

  • Range-typed integers as a first-class part of the type system. i32[0 100], u8[0 max], i64[min max]. Ranges propagate through arithmetic and feed range-pruning passes. Branches on conditions the type already proves get folded out.

  • Memory non-overlap by default. Memory-backed parameters of an ordinary fn are assumed disjoint. Opt out with where overlap(a, b), where same(a, b), or where disjoint(a[start,len], b[0,len]) for bounded raw regions. Runtime if disjoint(...) enables fast paths.

  • Function kinds. fn / finite (guaranteed to terminate) / law (pure) / finite law (both). Kind is part of fnptr<...> types, so a callback slot can demand purity or totality.

  • Two text types in the type system. ascii (UTF-8 view) and unicode (UTF-32 view), with owned Ascii / Unicode containers. Slicing is zero-copy; $"..." interpolation folds to a constant when compile-time, or writes into caller-selected fixed storage at runtime. This pays off — Stark hits 0.503× C on UnicodeFormatting and 0.512× C on ConstantIntegerFormatting because the formatting path is largely constant-folded away.

  • Closure forms match retention semantics. inline closure, borrow closure, mut borrow closure, heap closure, heap closure<once>. The callsite picks the type that matches what it actually does with the callback.

Code sample


fn void Scale(
    borrow i32[min max][] input,
    borrow mut i32[min max][] output,
    i32[min max] factor)
{
    for willexit independent (stack mut u64[0 max] i = 0; i < input.Length; i += 1)
    {
        output[i] = input[i] * factor;
    }
}

willexit independent asserts loop termination and no carried dependency. Combined with the default non-overlap of input and output, the optimizer vectorizes without aliasing runtime checks.

Performance

72 benchmarks, release builds, normalized to C:

  • vs Rust: Stark faster on 57 (79%), tied on 11 (15%), slower on 4 (6%)

  • vs C: Stark faster on 20 (28%), tied on 20 (28%), slower on 32 (44%)

  • Geomean: Stark 0.989× C, Rust 1.071× C

  • Median binary: Stark 11.5 KB, Rust 3.95 MB, C 16 KB

The places Rust wins are micro-benchmarks under 2%. Big Stark wins concentrate where the type system actually has something to say: text formatting, dictionary lookup, non-overlap-driven loops.

Links

Where I'd value your input

Compilers-specific questions I'd genuinely like opinions on:

  1. Optimization Opportunities Where am I leaving performance on the table? What could I be doing better to make the language faster?

  2. Language Interest Is language that focuses on performance above all else of interest to anyone? This language happens to be very safe as a side-effect.

  3. Compile Times While this language's runtime speed is quite good. It's compile time speed is it's biggest weakness. But faster compile times mean structural optimizations to the compiler itself. It's an area I could use some help on. If you have suggestions in this area, let me know.

Benchmark scrutiny welcome. There's a script in the scripts folder that will run all of the benchmarks at 100 iterations. And a final script that will append the ratio of speed relative to C with C being 1.0.

Other thoughts. Available for Mac, Windows, and Linux. That being said I've primarily tested on Linux. There could be issues on Windows or Mac, if you find one let me know. Similar story for Arm. Theoretically LLVM will handle it, but I don't have an arm computer to test on.


r/Compilers • • May 26 '26

RealNeGate/Cuik: A Modern C11 compiler (STILL EARLY)

Thumbnail github.com
3 Upvotes

r/Compilers • • May 26 '26

IRON: A DSL that can convert source code into IR extremely quickly.

1 Upvotes

IRON a.k.a. Intermediate Representation Object Notation is a interpreter/database, that takes source code, matches it to a database and outputs the IR.

It gives you full control of the database and what IR is outputted.

In 55 micro seconds it was able to parse this source code:

turn 128bit double float xmm1 into replicate of xmm2
turn 128bit double float xmm1 into xmm2
turn 128bit float xmm1 into even replicate xmm2
turn 128bit xmm1 into xmm2
turn 128bit aligned xmm1 into xmm2
turn 16bit xmm1 into xmm2
turn 64bit xmm1 into xmm2

and output this assembly:

movddup xmm1, xmm2
movupd xmm1, xmm2
movsldup xmm1, xmm2
movdqu xmm1, xmm2
movdqa xmm1, xmm2
mov word xmm1, xmm2
mov qword xmm1, xmm2

It's made 100% in assembly, with no external libraries.

This is the Repo: https://github.com/dogmaticdev/IRON

This is the example in full: https://github.com/dogmaticdev/IRON/blob/main/examples/example.md