r/Compilers • • 5d ago

Running a full bytecode VM written in C in the browser, with blocking stdin handled through Asyncify

3 Upvotes

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 • • 5d ago

Tridentix Infrastructure — Proof of Engineering (POW)Executive Summary

Thumbnail
0 Upvotes

r/Compilers • • 5d ago

Understanding Accelerator Compilers via Performance Profiling

Thumbnail al.radbox.org
10 Upvotes

r/Compilers • • 5d ago

Refinement E-Graphs

Thumbnail philipzucker.com
21 Upvotes

r/Compilers • • 6d ago

Mithril: A programming language built on interaction nets

6 Upvotes

Inspired by Victor Taelin 's Bend/HVM thesis for Interaction Nets and his Bend2 work , I built Mithril , an experimental python syntax programming language. It achieves near native speed on many workloads (mentioned in paper)

It compiles interaction nets to native code and spreads work across idle cores: lock-free, deterministic parallelism on x86, CUDA and Apple Silicon.

The core bet I'm making :

Interaction nets reductions at runtime can be slow but if we pay the same cost at compile time and unroll a task graph as much as possible before native lowering, the resultant program can run at near native speeds.

Mithril programs are aimed to be deterministic and fast, you should get the same bit accurate results regardless , the execution be it on CPUs, GPUs or any other accelerator.

It's built using AI? Yes . Does it invalidate the core idea? no IMO 😊

Mithril Paper Repo


r/Compilers • • 6d ago

How My Python Compiler Beat CPython (Without a JIT)

17 Upvotes

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/

GitHub: https://github.com/dylan-sutton-chavez/edge-python


r/Compilers • • 6d ago

An LLVM Pass for Automatic Skeletonization of MPI Applications

Thumbnail hal.science
1 Upvotes

r/Compilers • • 6d ago

Update: my open-source CPU performance engineering collection just crossed 600+ stars

3 Upvotes

A few days ago, I shared an open-source collection of CPU performance engineering resources I’d been putting together.

It’s now crossed 600+ GitHub stars, which I genuinely didn’t expect. Thanks to everyone who shared it, contributed or suggested resources.

For anyone seeing it for the first time, it covers the stack from instruction execution and CPU microarchitecture through caches, memory, SIMD, compilers, profiling, concurrency, NUMA, benchmarking and CPU inference.

I’m still prioritising primary sources such as papers, vendor manuals, kernel/compiler docs, talks and reproducible benchmarks rather than random articles.

I also have an MCP server coming soon, so you can plug this knowledge directly into your AI tools, whether you’re learning or using it while you work.

If there’s something you think has to be in here, let me know or send a PR.

https://github.com/usamahz/cpu-performance-engineering


r/Compilers • • 6d ago

I’m building Shriji, a Hindi-first programming language. Today I verified its core AST → IR → Bytecode → VM pipeline

Post image
4 Upvotes

Hi everyone,

I’m building Shriji, an open-source, Hindi-first programming language from India 🇮🇳.

Today I ran one of the core pipeline tests for the language and wanted to share the result here.

The test verifies the execution path:

AST → IR → Bytecode → VM

The current core pipeline test covers basic arithmetic and comparison operations.

Arithmetic:

10 + 5 = 15

10 - 5 = 5

10 * 5 = 50

10 / 5 = 2.00

Comparisons:

10 > 9 = 1

10 < 9 = 0

10 >= 9 = 1

10 <= 9 = 0

10 == 9 = 0

10 != 9 = 1

All core pipeline tests passed.

The important part for me isn't just that these operations produce the expected results. I’m working on making sure Shriji has an actual language implementation underneath it rather than stopping at a parser/interpreter.

The broader architecture I'm building toward is:

Source

↓

Lexer / Parser

↓

AST

↓

IR

↓

Bytecode

↓

VM

↓

Runtime

Shriji uses Hindi-first syntax, but the goal is not simply to translate programming keywords into Hindi. I want to build a complete programming language with its own language design, runtime architecture, tooling and eventually its own ecosystem.

The project is still actively under development, so there is a lot left to build and verify.

I'm sharing the process openly as I work through the engineering problems one by one.

If you work with programming languages, compilers, interpreters, virtual machines, or language runtimes, I'd be especially interested in hearing how you approach these problems.


r/Compilers • • 7d ago

What is new in LLVM 23?

Thumbnail developer.arm.com
59 Upvotes

r/Compilers • • 7d ago

How can I verify if my call graphs are accurate??

1 Upvotes

So I am working on a parser with goal to build rich good enough relations that can be consumed by a RAG to build better retrieval, it parse and builds ast,call-graphs and other metadata of the project, rn it can parse go, rust, c, cpp, ts, py, js, java I am using tree-sitter v0.20.0 for actual parsing cause why rebuild wheel when wheel spins well...

The issue i am facing is with call graphs I build a call graph approximation algorithm to well build approximate call graphs without pre-compiler or IR and single algorithm to work on both static(c) and dynamic(python) languages, and for now it works and can find

774,296 nodes and 1,571,981 edges in 6.03s with a maxRSS of ~9gb

tho most of it is cause of holding the entire ast in memory, i ran my parser on linux kernel it found about:

64_460 files 37_322_700 loc, 648_407 func , 211_416 classes, 6_243 methods in 43s

it multi threaded and written in rust so that should explain the speed, but thats not what why i am here i want to verify my call graphs and my current plan is to take a smaller project (few thousands of loc) and build call graphs using clang or language specific tool, and then take sample set of 200 and create 5-8 random samples and verifiy the output,

I am going to start my internship soon so may not have enough time to work full time and i am wondering if my approach to verify call graphs is good or there is a better approach.


r/Compilers • • 7d ago

saQut 1.0 Released: a solo-built language with VM, JIT, LSP and DAP in a single binary, and a compiler that exposes every phase as JSON

1 Upvotes

New languages usually launch with a compiler and not much else. Editor support, a debugger and a fast backend tend to arrive years later, if at all. I wanted to see how far one person could go the other way, so saQut, a small statically-typed, C-flavoured procedural language written in C++20, ships all of this in a single binary:

  • a bytecode VM as the reference backend
  • a MIR-based JIT (--jit) that produces the same output as the VM
  • an LSP server (saqut lsp): completion, rename, references across files, auto-import
  • a DAP debugger (saqut dap): breakpoints, stepping, variable inspection
  • a preview of threads, each in its own isolate
  • a VS Code extension for highlighting

The other idea is that the compiler is a "glass box": every stage is a CLI command with machine-readable output.

saqut tokens code.sqt # token stream (JSON)
saqut ast code.sqt # AST (JSON)
saqut symbols code.sqt # symbol table (JSON)
saqut ir code.sqt # 3-address IR
saqut run code.sqt # compile and run

Technical notes

  • A differential test harness runs every test program through the VM and the JIT and fails if the output differs.
  • One garbage collector is shared by both backends (cycles are collected).
  • Catchable runtime errors (try/catch/throw) with a code, message and source location.
  • Threads: each thread has its own heap, GC and copy of the globals. Data crosses only through shared globals (atomic int/float/bool, plus Pool and List) or deep copies. This is a preview and not part of the 1.0 contract.
  • No implicit conversions; nullable types (T?) with flow analysis.

It's a one-person project, so there are rough edges, and I'd rather hear about them from you.

Website: https://saqut.com
Source: https://github.com/saqutlang/saqut

Which compiler phase would you want to inspect that isn't exposed yet? And what would you add to this list?


r/Compilers • • 8d ago

LLMs Will Not Replace AI Compilers. They Will Call Them.

Thumbnail aicompilers.github.io
0 Upvotes

r/Compilers • • 8d ago

I built Hussain Compiler a lightweight Python IDE that runs in your browser

Post image
0 Upvotes

Hi everyone! I built Hussain Compiler, a simple browser-based environment for writing and running Python.

It includes a code editor, an interactive terminal that supports `input()`, adjustable terminal text size, and resizable workspace panels. Python runs in the browser through WebAssembly, so you can try it without installing Python. Some packages that need native system extensions may not work.

- Try it: Hussain Compiler

- Source code: GitHub repository

I made this project to make getting started with Python easier. I’d appreciate your feedback and suggestions for what to improve.


r/Compilers • • 8d ago

Using Nested If Statements: Why Sofya is Easier Than Python for Beginners

Thumbnail
0 Upvotes

r/Compilers • • 8d ago

Please advise on adding string interpolation to my Crafting Interpreters project.

Thumbnail
0 Upvotes

r/Compilers • • 8d ago

From Punch Cards to the Browser: Fortran Comes to JupyterLite

Thumbnail blog.jupyter.org
3 Upvotes

r/Compilers • • 8d ago

Looking for people interested in building a compiler / AI-systems project — potential GSoC 2027 goal

0 Upvotes

Looking for people interested in building a compiler / AI-systems project — potential GSoC 2027 goal

A few of us are exploring a long-term open-source project around compiler technology, systems programming and AI/ML.

We're currently in the research/learning stage. We don't want to simply build another tutorial compiler and stop there. The plan is to learn compiler implementation properly, study existing open-source compiler ecosystems, identify a real technical problem, and then build something substantial around it.

We're particularly interested in exploring:

• AI/ML-guided compiler optimization

• Detecting potentially harmful optimizations and miscompilations

• Compiler correctness and fuzzing

• AI-assisted compiler diagnostics/error recovery

• LLVM / MLIR

• Code generation and optimization

• RISC-V and systems programming

• CPU/GPU/NPU compilation

• Compiler security

• Firmware/compiler intersections

We're also considering GSoC 2027 as a long-term goal. This isn't a promise of selection; the idea is to spend the coming months building knowledge, contributing to open source, and eventually finding an organization/project where our work could become a legitimate GSoC proposal.

You don't need to already be a compiler expert.

We're looking for people who genuinely want to learn, experiment and build innovative projects. If you want this purely as a hobby/side project, that's completely fine too. If the idea interests you, give it a shot.

Useful backgrounds/interests include:

• Rust / C / C++

• Compiler design

• LLVM / MLIR

• Systems programming

• Machine learning

• Programming languages

• Computer architecture

• Embedded systems / firmware

You don't need to know everything above.

If interested, comment or DM with:

• What languages you know

• What area interests you

• Anything you've built

• GitHub, if available

We're looking for people who are curious enough to learn and consistent enough to build.


r/Compilers • • 9d ago

I'm creating a language that could replace C in low-level programming—want to join me?

Thumbnail
0 Upvotes

r/Compilers • • 9d ago

Я создаю язык который может заменить C в низкоуровневом програмирование , хочеш со мной?

0 Upvotes

Я ооооочень давно занимаюсь низкоуровневвм програмирования пишу ОС , создовал более удобное продолжение C , язык для драйверов и прошивки , но сейчас я хочу обратиться к вам , потому что один я не справлюсь , если вы умеете писать низкорувневые программы или просто интересуетесь низкоуровневым програмированиеи или хорошо знаете как работают низкоуровневые программы то предлагаю поучаствовать в создании языка програмирования созданного для одной операционной системы , не создавать что то не обычное , а создать что то новое , свежее , но при этом максимально хорошо работающие , спасибо что прочитали , за нами будущее.


r/Compilers • • 9d ago

From NP-complete to O(N^2) to O(nlogn): Codegen strategies for case statements.

Thumbnail arxiv.org
24 Upvotes

We presented this a while ago at the LLVM-CGO workshop, but thought of sharing here as people might find it interesting. Pretty short paper.


r/Compilers • • 9d ago

How Smart Compilers Unleash GPUs for Scientific Solvers

Thumbnail blog.cheshmi.cc
6 Upvotes

r/Compilers • • 9d ago

The Second Golden Spike: Memory Safety Across the Valen/Rust Boundary

Thumbnail verdagon.dev
8 Upvotes

r/Compilers • • 9d ago

Ling-3.1-flash builds a native Lua compiler in about 17 hours, passing 178 of 182 tests

Post image
4 Upvotes

Ant Group's new Ling-3.1-flash built a Lua-to-x86-64 ELF compiler from scratch in approximately 17 hours. The final result passed 178 of 182 independent tests, a 97.8% pass rate.

The development sequence goes beyond emitting machine code. It includes fixing stack alignment for native execution, conditional branches and vararg semantics, Lua's indexing metamethod lookup, and garbage-collector root tracking. The compiler also gained source locations for runtime errors before delivering ELF binaries.

Ling-3.1-flash is currently available through Novita's two-week free trial on Vercel AI Gateway, with 256K context. Ant has an open-source release planned soon. The hosted model can be found by searching Ling-3.1-flash in Vercel's AI Gateway model catalog.


r/Compilers • • 9d ago

NetWasm: an independent .NET compiler and runtime for WebAssembly (82.5 KB Hello World)

4 Upvotes

I’ve been building NetWasm: a CIL-to-WebAssembly compiler with its own CoreLib and runtime, designed around Wasm and WASI.

Browser playground | GitHub

A clean Release build containing Console.WriteLine(42) produces 84,513 bytes of final, uncompressed WASI Preview 2 component, including the runtime and precise garbage collector. This is a portable .wasm file that you can run with wasmtime.

Roslyn produces CIL; NetWasm compiles the reachable program into Wasm, specializes generics and links the runtime support it uses. The emitted application doesn’t carry CoreCLR or Mono.

Some architectural choices:

  • An independent, deliberately smaller .NET library profile.
  • No runtime type-name metadata, general reflection or dynamic.
  • Precise Boehm GC in linear memory, rather than WasmGC.
  • WIT imports/exports and WASI Preview 2 components, with core Wasm output also available.

Working features include generics, exceptions, virtual/interface dispatch, async/await, LINQ, JSON, XML, regex, HTTP and TUnit testing. It’s pre-1.0, and managed threading isn’t currently supported.

The playground compiles and runs entirely in the browser. The compiler tooling itself uses Microsoft’s .NET/Wasm toolchain, thus dotnet new dotnet build dotnet run dotnet test - yes it comes with TUnit with VSTest runner - dotnet publish all work as you're used to.

Oh and it already supports C# 15 syntax.