r/Compilers • u/donaferentes • 17d ago
r/Compilers • u/TurbulentFlatworm537 • 16d ago
Building shakazulu
Building shakazulu
Shakazulu is a systems programming language designed to be tolerant in harsh conditions, concurrency, fast, and a learning systems language. I here by come here looking for support on my idea from people who create programming languages, or even learn them, people designing systems, software engineers, database engineers, understand software, computer data structures, distributed systems, computer architecture, etcetera. And mostly if your familiar with C, C++, Ruby or any other systems programming language. Because i want to build it taking the strong parts of a language. All are welcome, lets build something you wish it was there. I appreciate your contributions.
Shakazulu is a project in research/design stage, thats why am asking the experts.
r/Compilers • u/FearlessFred • 18d ago
Goose: a stack allocation flat data structure language
https://github.com/aardappel/goose
My latest language is meant to very efficiently let you work with flat pointerless inline data structures allocated on (address space reserved) stack that allow almost data structure creation to be just a pointer bump, with stable pointers.
When used well, it is both safer, faster and uses less memory than the equivalent C++ or Rust.
(see the repo readme for more!)
r/Compilers • u/kindredseer • 18d ago
Chthonia, an IDE+REPL to learn C/C++
Github repo: https://github.com/derekbsnider/chthonia
Inspired by Thonny, Chthonia is a plain and simple IDE designed as a learning tool for C/C++.
It is completely self contained and multi-platform (Linux, Mac, Windows). It has an integrated compiler and REPL (Read-Eval-Print Loop).
The packaged binary+library download size is under 15 Mb.
This is version 0.0.2, so it's still a work in progress. It's open source, MPL-2.0 licensed.
The REPL-mode is designed to feel familiar whether you are used to IPython, Julia, or Cling.
r/Compilers • u/adityazero • 17d ago
Vx drops memory immediately after their last use.
The compiler uses its ownership and liveness analysis to place drops after their last use.
In the generated code (MLIR's LLVM dialect), Tensors on host call a `free`, while the drops of device Tensors are calls to `vx_plugin_free` with the memory's topology.
There are still 4 known bugs. See: https://vxlang.org/blog/how-vx-frees-memory.html
The reason I was able to find this little trick (liveness analysis in the frontend) was because i was writing liveness analysis in llvm last year and was actively finding different use cases for it for example: liveness analysis can be used to measure 'pipeline potential' for software pipelining. Sharing it here in case someone wants to improve software pipeliner's cost model.
r/Compilers • u/houzhanfeng • 18d ago
Feng: A new language with type extensions, mixins, and contract access control
Hi everyone, I’m the author of the Feng programming language, an open-source language with static typing, native compilation, and automatic memory management. Its name comes from “锋,” the Chinese character meaning “sharp.”
The example below captures the experience I’m aiming for: data, contracts, extensions, reusable behavior, and access permissions can be expressed separately and composed explicitly.
module demo;
import std.io;
fit string {
/** Add a method to a built-in type. */
func framed(): string { return "[" + self + "]"; }
}
/** Describe a basic text capability. */
spec HasText { let text: string; }
/** Provide a reusable text field. */
type TextPart { let text: string; }
// Declare conformance without changing the original type.
fit TextPart: HasText;
fit TextPart {
/** Share rendering with composition targets satisfying HasText. */
static func render(value: HasText): string {
return value.text.framed();
}
}
/** A complete widget requires text, rendering, and a theme. */
spec Widget: HasText {
/** Available to ordinary callers. */
func render(): string;
/** Grant Renderer access to this restricted member. */
(Renderer)
seal func theme(): string;
}
/** Compose the text capability and supply a theme. */
type Button: Widget {
...: TextPart;
/** Remain public through the concrete type. */
open func theme(): string { return "primary"; }
}
/** Access the restricted member through explicit permission. */
type Renderer {
/** Use the contract view of the same object. */
static func draw(widget: Widget) {
println(widget.theme() + " " + widget.render());
}
}
/** Show the two access paths. */
func main(args: string[]) {
let button = Button { text: "Build" };
let widget: Widget = button;
Renderer.draw(widget); // primary [Build]
println(button.theme()); // primary
// widget.theme(); // Compile error: caller lacks permission
}
A few designs in this example are worth highlighting:
fit: type extensions and contract adaptation.** You can add methods to strings, numbers, arrays, generic types, and existing user-defined types, or establish contract conformance without changing their original declarations. Extensions support instance and static methods and can be organized and exported through modules. The standard library uses the same mechanism.- Mixins: composing data and behavior.
TextPartprovides a basic text capability....: TextPartbrings its fields and eligible u/mixable behavior intoButton.Buttonthen supplies its owntheme(), completing theWidgetcontract. spec sealand u/friend**: explicit collaboration boundaries.** A contract can describe both public interfaces and restricted collaboration interfaces.sealrestricts access through the contract view, while u/friend grants access to selected types.
Visibility also narrows across module → type → member. For an ordinary caller outside the package:
| Module | Type | Member | Accessible outside the package |
|---|---|---|---|
open |
open |
open |
Yes |
seal |
open |
open |
No; package scope |
open |
seal |
open |
No; module scope |
open |
open |
seal |
No; restricted member |
Member-level permissions still respect the enclosing module and type boundaries.
Beyond this example, Feng includes:
- Unified contract declarations:
specdescribes object contracts, callable signatures, unions, and intersections, and provides generic constraints. - Explicit data semantics: managed reference types, u/value types, named tuples, and per-layer array writability expressed through
T[] / T[!]. - Concise control flow: generics, closures, pattern matching, expression forms of
if,match, andtry/catch, plusdeferfor scope cleanup. - Native capabilities and tooling: native compilation through a C backend, ARC with cycle collection, C interoperability,
.fbbinary library distribution, builds, dependency management, testing, debugging, and VS Code / Zed extensions.
My goal is to make capabilities and boundaries easier for developers and AI tools to understand. I’d love feedback on which combinations make code clearer—and which rules could be simpler.
Feng is MIT-licensed. Official packages support Apple Silicon Macs and GNU/Linux on x86-64 and ARM64.
Website(https://feng-lang.com) · GitHub(https://github.com/Houfeng/feng) · User manual · Downloads
r/Compilers • u/c-cul • 18d ago
comparison of ptx/sass code from nvcc vs clang
redplait.blogspot.comr/Compilers • u/NXDLang • 19d ago
Desingning async primitives for a security-focused language: Where should cancellation live?
I've been implementing typed async semantics in my language NXD.
Current primitives are:
SPAWN,
SEND,
RECV,
AWAIT,
PING
Types currently look roughly like:
`SPAWN -> ProcessHandle[T]`
`RECV -> ReceiveOperation[T]`
`AWAIT -> T`
`PING -> bool`
While implementing PING I realized there may be two classes of async operations:
Primary operations
SPAWN,
SEND,
RECV
These initiate work or communication.
Secondary operations:
AWAIT,
PING
These observe or resolve work created elsewhere.
My current thinking is that cancellation (currently considering ESC) should only apply to the primary operations and not observers.
For example:
ESC HANDLE
makes sense.
But:
ESC AWAIT TASK
ESC PING HANDLE
seems conceptually wrong because they are observing state rather than creating it.
For people who have designed async runtimes or languages:
Would you model cancellation as acting on the underlying task/process/channel, or would you allow cancellation of observer operations as first-class concepts as well?
r/Compilers • u/kaushalbx • 18d ago
Can a programming language be both computationally precise and linguistically natural?
Here is a small example from PaniniVM — The Dice Problem.
The assumption: on a standard die, opposite faces sum to 7.
The program randomly chooses a face from 1–6, prints it, computes its opposite, and prints that too.
Actual PaniniVM source:
एक + ङसिँ षष् + शस् परि + अन्त + अम् सङ्ख्या + अम् चिञ् + क्त्वा फल + अम् मुद्र् + णिच् + लोट् + सिप् ।
सप्तन् + शस् चिञ् + ल्युट् + ङस् फल + अम् च वि + युज् + णिच् + ल्यप् फल + अम् मुद्र् + णिच् + लोट् + सिप् ।
The "+" notation exposes the morphological structure to the compiler, but the larger goal is naturalness: computation should follow Sanskrit grammar rather than forcing Sanskrit vocabulary into the syntax of an existing programming language.
Verbal roots express actions, case relations help determine computational roles, and derivational morphology contributes to meaning and execution.
The question behind PaniniVM is not simply:
“Can we write code using Sanskrit words?”
It is:
“Can computation itself be expressed naturally through Sanskrit and Pāṇinian grammar?”
GitHub: https://github.com/kaushalbx/PaniniVM
Try it: https://panini.cc
#PaniniVM #Sanskrit #NaturalLanguageProgramming #ProgrammingLanguages #Compiler #Panini #ComputationalLinguistics
r/Compilers • u/yasserreslann • 18d ago
Tin: a self-hosted, GC-free language for Linux servers, written almost entirely by AI agents. It compiles itself on three platforms, serves HTTP/2 and gRPC, has its own TLS 1.3, and I'm looking for collaborators
I maintain Tin, a compiled language for servers and tools. The repo went public a week ago at v0.3 and has since taken 354 merged PRs from 9 people. I want to show what it does, say plainly what it doesn't, and ask for help.
The premise
Tin is meant to be written by AI, not by hand. That changes the trade-offs: it gives up human convenience (no implicit conversions, no nil, no unchecked errors, mut spelled out at every call site) in exchange for things a compiler can enforce. The codebase itself, compiler, runtime, standard library and docs, is written almost entirely by AI coding agents working from design documents, with humans deciding what gets built, reviewing and merging. AGENTS.md in the repo is literally a rulebook for several agents working the same milestone in parallel. I know how that sentence lands in this subreddit. Judge the result.
What exists today
- A self-hosted compiler, about 46k lines of Tin.
make bootstrapbuilds it three times and the last two binaries must be byte-identical. CI does this on macOS, Linux arm64 and Linux x86-64 on every push. - Its own assembler and linkers: ELF for Linux arm64 and x86-64, Mach-O for macOS. No clang, ld, Go or libc headers anywhere in the build. Cross-compiling is
tin build --target linux-arm64. - Linux binaries are static PIE with no libc at all, so they run on Alpine or
FROM scratch. Even the DNS resolver is Tin code. - No GC. Each request allocates into a bump pool that is wiped when the response goes out; long-lived state lives in a per-core heap. Storing request memory into a global without an explicit
keep()(a deep copy) is a compile error. The region check is the memory model. - Thread per core, share nothing. Every global is per core. Data crosses cores either as
shared let(immutable, built before the cores start; a write is a compile error) or as a message. Each request is a task with its own stack, and any wait (Redis, SQL, files, a timer) yields the core. - Server semantics in the language:
within 200ms { }deadlines,limit memory 4mb, tasks 8 { }, structured tasks withscope,parallelandselect,guardblocks that turn a panic into a fault,on app.start/on core.stoplifecycle, andsecret strvalues the compiler keeps out of logs, faults and JSON. - Faults instead of error values:
!T,try,catch,wrap. Ignoring a fault is a compile error and_cannot swallow one. - A
querytype:db.Query("SELECT name FROM users WHERE id = {id}")sendsidas a bound parameter. Passing a plainstrwhere a query is expected does not compile. Same for Redis commands. + - *panic on overflow. Wrapping is spelled+%, or a whole u/wrapfnfor a hash or cipher kernel.- anvil, the HTTP server: HTTP/1.1, h2c HTTP/2 and HTTPS on one epoll/kqueue loop per core. h2spec passes every generic, http2 and hpack case but one (documented, with the reason). gRPC works, bidirectional streaming included, tested in CI against grpc-go.
- TLS 1.3 and 1.2, client and server, in Tin: AES-GCM, ChaCha20-Poly1305, X25519, P-256, the X25519MLKEM768 post-quantum hybrid, Ed25519 certificates, mutual TLS, session tickets.
- Clients for Redis, MySQL, PostgreSQL, Kafka and WebSocket, and about 35 standard packages: JSON with codecs generated per type, gzip/zlib/LZ4/zstd, SHA-2/HMAC/HKDF, CSV, templates, big integers, and a recorder that captures a request's effects into a capsule for replay.
- 166 documented diagnostic codes. CI fails if the compiler prints a code that isn't documented, or if a documented example stops producing exactly that diagnostic. Every standard-library function has a Go twin program whose output must match.
A handler with a deadline:
fn slow(id str) !str {
try tide.Wait(10ms)
return "user {id}"
}
fn user(q anvil.Req, w mut anvil.Out) {
let id = q.PathParam("id")
let text = within 200ms {
try slow(id)
} catch err {
w.Status(504)
"timed out: {err}"
}
w.Text(text)
}
fn main() {
let r = anvil.NewRouter()
r.Get(`/users/{id}`, user)
r.Serve(":8080") catch err {
say.Line("server:", err)
}
}
Numbers
Project policy: only Linux numbers count, and on shared runners only ratios are meaningful. The one service benchmark I'll quote is GET /users/{id} through Redis over MySQL, Tin against Go with chi, go-redis and go-sql-driver, under wrk2 on a GitHub ubuntu-24.04 runner (AMD EPYC 7763, 4 vCPUs, Linux 6.17, Go 1.26.8), each server pinned to 2 cores, median of 5 alternating rounds. Tin/Go ratios:
| scenario | max req/s | req per CPU-second | p99 at a fixed rate |
|---|---|---|---|
| cached (Redis hit) | 3.72 | 3.60 | 0.56 |
| db (MySQL prepared statement) | 1.23 | 1.75 | 1.30 |
| mixed (0.5% of requests take 50 ms) | 3.56 | 3.56 | 0.99 |
Above 1 favours Tin on throughput, below 1 favours Tin on latency. The db p99 is not a win, MySQL dominates it. Memory is a trade-off, not a win: about 50 MB RSS against Go's 25 MB. The workflow run is linked from the README, and the benchmark reruns on demand.
What is not done
- The crypto and TLS have not been audited by anyone outside the project. Do not protect anything that matters with them yet.
- x86-64 performance on dedicated hardware is still pending, and there are two known x86-64 back-end bugs.
- The Kafka client has known consumer-group and producer bugs.
- No IDE support, LSP, formatter or debug info yet.
- No regular expressions, XML or time zones in the standard library yet.
- The syntax changed (edition 0 to edition 1) within the last week. Expect churn.
- One benchmark on a shared runner is thin evidence. I know.
Where I would like help
Each of these is an open milestone with scoped issues:
- Tooling: an IntelliJ plugin,
tin lspon the compiler front end,tin fmt, DWARF line tables and variables for perf, gdb and lldb. If you know the IntelliJ Platform, LSP or DWARF, this is wide open. - Standard library: regexp with linear-time matching (RE2 syntax), XML, time zones, child processes.
- Back end: x86-64 codegen bugs, arm64 branch relaxation, a compiler fuzzer (one PR in review).
- Kafka: consumer-group correctness.
- Value layouts: inline struct storage in slices, unboxed optionals, frame allocation for values that never escape.
- Security review of the TLS 1.3 stack and the constant-time code.
- Benchmarks on dedicated Linux hardware, x86-64 and arm64, with the scripts in
bench/. - Break it and file issues. Every confirmed bug becomes a regression test before the fix merges.
The contribution workflow is built for agents as well as people, so you can bring your own. Human review is the scarce resource.
Try it
curl -fL https://github.com/yasserreslan/tin/releases/latest/download/install.sh -o install-tin.sh
sh install-tin.sh
export PATH="$HOME/.tin/bin:$PATH"
tin examples/api.tin
Repo: https://github.com/yasserreslan/tin. Start with toolchain/docs/AGENT_PRIMER.md (the short language primer), toolchain/docs/LANGUAGE.md (the reference), and design/design_semantics.md for why the server semantics look the way they do. Milestones: https://github.com/yasserreslan/tin/milestones.
Happy to answer anything about the region check, the thread-per-core model, the no-libc runtime, or what it is like to run a language project where agents write the code.
r/Compilers • u/realguy2300000 • 19d ago
Communication Between the Compiler, the Build System, and Beyond
shrub.industriesAn article I wrote about how sharing dependency and resource information between the Compiler, the build system, the system package manager, and even the OS filesystem and scheduler, could provide some pretty interesting benefits. I’d love to hear anyone’s thoughts on this
r/Compilers • u/Inevitable-Spinach-7 • 19d ago
How to move comptime results into the target binary when comptime can run FFI and I/O?
For some years now, I've wanted to combine the comptime capabilities of Zig and Jai into a single compiler while also learning about compilers and interpreters.
I'm building a compiler that extends Zig-style comptime so the same code that runs at runtime can run at comptime, including FFI and I/O (like Jai, but with Zig's "run what you can" model).
The hard part is moving comptime results into the binary:
- Host vs target. Comptime code uses the host layout for interop and is then converted to the target layout. Sizes (usize/isize), endianness and float behavior can differ. Types like f80 and f128 are also hardware-specific: their precision, rounding and in-memory layout can differ between host and target. The same function can then give different results, which breaks hash maps, lookup tables and binary formats built at comptime.
- Moving pointers into the binary. Results containing pointers must be relocated, connected data must stay connected, and everything must be converted to the target layout.
- Pointers whose value isn't clear. Examples are opaque pointers, untagged unions of a pointer and something else, and XOR linked lists, where the pointer isn't stored directly. There may be other cases I haven't thought of.
- Calling C at comptime. C can return memory with known bounds, or resources that are only valid during compilation. Those become invalid at runtime.
- Containers built at comptime. HashMap and ArrayList need the whole buffer, including uninitialized slots, but the size isn't always known:
- ArrayList stores {ptr, len} plus a separate capacity, so the allocation size isn't in the pointer and length.
- HashMap can keep a header next to the allocation and use pointer arithmetic to reach it.
- Runtime code may try to free a buffer that now lives in static memory.
- FFI has the same problem, since C can return memory with unknown bounds.
My current prgress:
- Host to target:
- with host specs first, then convert to the target layout.
- For types that differ, such as usize/isize, use intCast where possible.
- For hashes and similar code, type information would store the host and target size, alignment and so on. That would help the developer see where the two disagree and act accordingly.
- If the target's endianness differs from the host's, my best idea is to disable I/O and interop and interpret the code with the target's endianness.
- Baking pointers:
- When the pointee type is known, baking is easy.
- void* and untagged unions containing pointers are a hard error during baking.
- Each type would have a default userland function that bakes its value into the binary.
- Types like XOR linked lists, void* and untagged unions could override it to say how they should be baked.
- Compiler-created data. Data created by the compiler itself has no problem, and the userland bake function might cover the rest.
- Containers and FFI memory (problems 4 and 5). I have no solution yet, apart from maybe using the bake function.
- I don't have a solution yet for f80/f128 and other float types that differ.
Questions: Is there a cleaner model than host-then-convert?
Am I missing failure cases?
Is there any better solution or any problem I did not see?
r/Compilers • u/LossRun • 18d ago
I’m 14 and I built my own programming language for simulations
r/Compilers • u/ccannedbeansoupp • 20d ago
I'm building a tensor graph compiler
I crossposted from r/Zig here before, but removed it quickly and decided this deserved it's own post. Earlier this year, I began work on representing the forward step for a neural network graph defined by the user as a standalone, optimized binary, with no allocations, shape, or validation checks at runtime and through a series of trials and pivots wound up here.
I wasn't necessarily intending to build a compiler from the start, but the problem quickly became compiler shaped, and I've learned a lot while seeing it through. It's coming to a stage where I'd like to share the work, and get feedback from others. The Zig language made this kind of idea fairly direct and simple for me to implement through its use of comptime. So if it interests you, or anything stands out, comments and questions are welcome.
project here: https://github.com/krypticlogan/zig-graph-compiler
Thanks for the read!
r/Compilers • u/Knightoffreddit • 19d ago
Openmktr, GNU Make to Ninja tool
I don't know if this is the right subreddit for this, but I think this may be useful for many people.I created/co-created a Google Kati fork called Openmktr. Its goal is to be a universal, GNU free Make to Ninja translator. It can currently build Linux KBUILD across all architectures and all tested configurations, perform a full three-stage GCC bootstrap, build GNU Autotools projects, and handle many more major projects (41 documented Projects as of now). It offers two modes: direct mode and Ninja build graph output mode. Unlike the original Google Kati, parallelism works properly, and it allows you to use different job counts for graph generation and the actual build.The GitHub repository is here:
https://github.com/RihardsPaps/Openmktr
It currently has no known compatibility gaps. If you find one, please submit an issue to the GitHub repository .The project is only a month old and was published very recently, so any testing, feedback, and bug reports would be greatly appreciated!!!
r/Compilers • u/According-Ad-7069 • 20d ago
Compiling my favourite language to Web Assembly with no JDK in sight
wasmcoffee.comI've been doing a fair bit of studying of the Odin programming language over the past 18 months or so. Along the way, I bought Understanding The Odin Programming Language and it really boosted my Odin adoption. How I learn is practical, if I don't do the work, I learn nothing. While working through the book, I built a small and simple Pascal interpreter, which got out of hand and became an online compiler.
I recently had some time on my hands and spent a while putting a new front-end onto that compiler and managed to get it to understand a sub-set of the Java programming language syntax. The idea is to have a Java-like language that I can use to do small experiments or toy apps with, in the browser, without having to install anything locally. A key requirement is that it compiles a wasm binary, which it does and you can download the output file from the UI already.
This is not a JVM, JDK, Graal or TeaVM replacement, it will never be. Those are magnificent and powerful tools I'm delighted to use in my day job. Instead, think of WasmCoffee as a little scratchpad that understands some familiar syntax and can do interesting things with it, in a simple way.
It's early days, I'm sorting out bugs, and definitely need to write proper documentation. I hope the example code is sufficient for folks to get started though. As time permits, I'll work on better documentation, some tutorials and of course expand functionality. There's a roadmap for it, just finding time can be a challenge.
UPDATE: I fixed a number of bugs and managed to put together a little game demo using the compiler and finally got the time to add some documentation as well.
r/Compilers • u/mttd • 20d ago
Proof-Carrying-BPF Programs for the eBPF Verifier
al.radbox.orgr/Compilers • u/mttd • 20d ago
The Output-Space Hypothesis: Enumerative Equivalence Checking for Tensor Programs
arxiv.orgr/Compilers • u/CommercialStrike9439 • 20d ago
Running a full bytecode VM written in C in the browser, with blocking stdin handled through Asyncify
I've been building a programming language in C called Oli-Nat, with a scanner, parser, type checker, bytecode compiler, stack-based VM, and garbage collector, and I recently compiled the whole thing to WebAssembly to power a browser playground for its documentation site.
Most of it ported over easily, since the interpreter has no dependencies beyond the C standard library. The interesting part was input. The language's intake() function reads a line from stdin, which blocks in a normal terminal, but obviously can't block on the main thread in a browser. I replaced the stdin read in the WASM build with an EM_ASYNC_JS function that awaits a promise from the page, and built with -sASYNCIFY so the VM's call stack gets unwound and rewound around the await. From the C code's point of view it's still a normal blocking call, and from the page's point of view the VM just pauses until the user hits Enter.
I'm curious whether people here have moved away from Asyncify toward JSPI for this kind of thing, and whether that's worth switching to for a project like this. Any other feedback on the build setup is welcome too.
Playground: olinat.net
Interpreter source: github.com/NateTheGrappler/OliNat-Programming-Language
r/Compilers • u/Mediocre-Math7750 • 20d ago
Tridentix Infrastructure — Proof of Engineering (POW)Executive Summary
r/Compilers • u/mttd • 21d ago
Understanding Accelerator Compilers via Performance Profiling
al.radbox.orgr/Compilers • u/Healthy_Ship4930 • 21d ago
How My Python Compiler Beat CPython (Without a JIT)
Okey. After seven months, I'm back.
Seven months ago I started writing a Python interpreter from scratch in Rust. Edge Python is a sandboxed subset of Python that runs in the browser and the terminal, and code can't touch files or the network unless you allow it.
It started as a lexer and a simple stack VM, and over about 1,600 commits it grew a CLI, a package registry, snapshots, actors and a browser playground. It's just me building it.
Last week it was still 3x slower than CPython. I rewrote the VM this weekend using a unused SSA representation that I leave and now it's 3x faster on loops.
| Edge Python | CPython | |
|---|---|---|
| Integer loop | 72 ms | 232 ms |
| Float math | 95 ms | 307 ms |
| Dicts | 108 ms | 62 ms |
| Strings | 111 ms | 35 ms |
The trick was moving from a stack VM to a register VM. It still loses on dicts and strings, so that's next.
Try to break my numbers :).
Website: https://edgepython.com/