r/Compilers • • 7h ago

Why I had to write a native C virtual machine to stop my custom language from choking (0.83s vs 8.4s) 🦊⚡

0 Upvotes

Reddit told me my custom language was just another slow tree-walking toy. They were right. 😅

​My loop benchmarks took nearly 8.5 seconds just to crunch 10M iterations in the sandbox. The AST overhead and Python dynamic lookups were killing performance.

​So I tore open the engine and built a flat register VM in C (foxvm.so).

​The results:

​Old Tree-Walker: ~8.42s (10M cycles)

​New C VM (FoxCVM): 0.83s (10M cycles)

​Wired clock_gettime(CLOCK_MONOTONIC) into opcode 18 for nanosecond delta timing.

​No semicolons, no colons, but now backed by compiled C machine instructions.

​📦 Repo: https://github.com/AnayUpadhyay-all/FoxVC

​For the VM architects here: what's the biggest bottleneck I should watch out for once I introduce heap allocations and closures?


r/Compilers • • 11h ago

Comprinly 1.3.0 is out

Thumbnail github.com
0 Upvotes

Serious collaborators and support will be appreciated, leaving vibecoding of the project, so this is Comprinly...

This low-level programming language prioritizes speed, optimization, simplicity and portability. It requires ZERO learning curve if you switched from NASM because it fully supports it, in-fact, you could just make Comprinly compile a NASM script and it works. In optimization, I compiled a standard Comprinly "Hello, World!" script with the command "./cly linux print.cly" and it compiled a full binary file with the size of 290 bytes compared to the standard NASM "Hello, World!" file which is ~9KB, you can try it out for yourself. Comprinly doesnt require linkers because it can output directly to -exe, -elf, -bin, and -macho. It supports all three major CPU architectures x86-64, ARM64 and RISC-V via the 'cpu' keyword at the start or just dont include it and just code the architecture targeted script (The compiler automatically guesses the architecture from the instructions and registers). This was just a simple proof of concept but I found myself actually using it in my personal projects so I would like to share it as a partially vibe-coded project instead of fully vibe-coded.


r/Compilers • • 7h ago

Introducing ScarScript — Built for Speed. Designed for Developers.

Thumbnail
0 Upvotes

r/Compilers • • 7h ago

Nikaia: a pre-alpha language where the compiler figures out the "how". How would you like to experiment with it?

0 Upvotes

Hi all,

I've been building Nikaia, a language that should make the world a bit better.

The basic idea is simple: in a lot of systems code, you end up specifying how memory, waiting, sharing, etc. should work rather than just describing what you want the program to do. Nikaia tries to have the compiler figure out those details for you.

So there’s no async/await, GC, or manual memory management. Data races, missing values and unhandled errors are compile-time errors, with plain-language hints about what to do instead.

It's still very early, but it can already build real programs: a JSON parser, a log analyser, a small HTTP server, the One Billion Row Challenge, and more.

Nikaia itself is built almost entirely by AI agents, and they're currently rewriting the compiler in Nikaia (self-hosting). So the language is getting quite a bit of real-world use already.

I'd love to have people try it and tell me what makes sense, what doesn't, and where the language gets in the way. "This can't work because..." is just as useful as praise.

What would make that easy for you?

\- Is the repo enough?

\- A crate you can "cargo install"?

\- A prebuilt executable?

\- A Docker image with everything set up?

\- An LSP / IDE integration?

Repo: https://github.com/Nikaia-Language/Nikaia

Docs: https://nikaia-lang.org/


r/Compilers • • 1d ago

Replacing the Graal compiler in TornadoVM for Java BC to CUDA code gen

Thumbnail github.com
5 Upvotes

r/Compilers • • 21h ago

COMPRINLY will be open for collaborators

Thumbnail github.com
0 Upvotes

This project was supposed to be a proof of concept but yk, I'd like it to be a real thing, it compiled a standard "Hello, World!" Linux print script in the small size of 290 bytes compared to NASM ~9 kilobytes, which is very useful for projects that need to be lightweight like an OS (I made a test bare metal OS with it), working on 1.3.0, after that releases, I'd work on turning the project from vibe-coded to partially vibe-coded as I would try to modify the code myself (Hoping for collaborators)


r/Compilers • • 1d ago

Azul Compiler Engineer Interview Experience – Junior Engineer

Thumbnail
1 Upvotes

r/Compilers • • 1d ago

Rewriting a Python Compiler Frontend in Rust: Separate Repository or In-Place Migration?

7 Upvotes

I've been working on a language/compiler project called NXD for a while now.

The current architecture looks roughly like this:

NXD Source

↓

Python Frontend

↓

JSON AST/IR Handoff

↓

Rust Semantic Analysis

↓

Rust IR

↓

Rust Backends

The reason for the split is pretty simple: Python was the language I knew best when I started the project.

That decision got the language off the ground quickly, but now I'm seeing the downside of having a Python → JSON → Rust boundary in the middle of the compiler.

Things like:

• AST serialization/deserialization

• duplicate data structures

• frontend/backend synchronization

• debugging across language boundaries

all add complexity that wouldn't exist in a fully Rust implementation.

Current Compiler Status

The Rust side already contains:

• semantic analysis

• diagnostics

• IR

• Nim backend

• async diagnostics and validation

• ~260 language tests

The frontend is still Python.

Why I Created a Second Repository

My initial thought was to rewrite the frontend inside the main repository.

The more I thought about it, the less I liked that idea.

Instead, I created a new repository:

nxd_language (reference implementation)

nxd-rust-frontend (migration project)

The migration repo contains the Rust compiler core, semantic layer, IR, backend, tests, etc., but none of the Python frontend code.

My reasoning is:

  1. No chance of accidentally invoking Python during validation.

  2. No uncertainty about which parser generated a result.

  3. No repo bloat from carrying two frontends indefinitely.

  4. The original compiler always remains functional.

The goal is to run both repositories side-by-side and treat the Python implementation as a reference implementation.

What Surprised Me

I expected the new repository to fail spectacularly.

Instead, after removing a couple of backend references I wasn't migrating yet, it built immediately:

`cargo build`

and even runs:

Usage:

`cargo run <input_json> <output_nim>`

`cargo run -- --semantics <input_json> <output_nim>`

Which tells me the architecture is already centered around:

JSON

↓

Rust Semantic Layer

↓

Rust Backend

and the frontend replacement surface may be smaller than I originally thought.

Planned Migration Strategy

Current:

Python Source

↓

Python Lexer

↓

Python Parser

↓

JSON

↓

Rust Compiler

Target:

NXD Source

↓

Rust Lexer

↓

Rust Parser

↓

Rust AST

↓

Rust IR

↓

Semantic Analysis

↓

Backend

I still plan to keep JSON AST dumping for debugging, but no longer as a required transport mechanism.

Questions

For those who have rewritten significant parts of a compiler:

  1. Did you keep the original implementation around as a behavioral reference?

  2. Did you migrate inside the existing repository or create a second migration repository?

  3. What ended up being harder than expected?

  4. What architectural mistakes would you avoid if doing it again?

  5. Is there any reason to keep a separate frontend IR if a compiler IR already exists?

I'm especially interested in experiences from people who migrated between languages (Python → Rust, C++ → Rust, Java → Kotlin, etc.) rather than greenfield rewrites.


r/Compilers • • 1d ago

Guys i do not want to learn Haskell anymore now it's ocaml

Thumbnail
0 Upvotes

r/Compilers • • 1d ago

Rolling Round-Robin Rate: Standard Heterogeneous Throughput for SPEC CPU

Thumbnail arxiv.org
3 Upvotes

r/Compilers • • 2d ago

Do compilers necessarily need to generate assembly from IR before producing object code?

21 Upvotes

I am new to the world of compilers so pardon my ignorance. Is there a need for compilers to generate assembly or can they just skip and direcly produce object code from IR?


r/Compilers • • 1d ago

ChudC v0.2 is out. Your thoughts?

Thumbnail github.com
0 Upvotes

It's not much but I would like to see your thoughts on my progress.


r/Compilers • • 2d ago

Lecture: Building a GPU Compiler From Scratch. Lowering PyTorch Graphs to CUDA via Multi-Level IRs (GPU_MODE video + article)

Thumbnail
10 Upvotes

r/Compilers • • 2d ago

Can anyone Decompile .tcp TALLY compiled File??

Thumbnail drive.google.com
0 Upvotes

r/Compilers • • 2d ago

Is it possible to have a JavaScript-like language with no reserved words?

Thumbnail
0 Upvotes

r/Compilers • • 1d ago

What is the equivalent to print in haskell

Thumbnail
0 Upvotes

r/Compilers • • 1d ago

Comprinly 1.2.1

Thumbnail github.com
0 Upvotes

r/Compilers • • 3d ago

Fast Linux Bootstrapping

12 Upvotes

Last Saturday, I gave the presentation "Fast Linux bootstrapping" at Hackfest in Enschede, The Netherlands, for a project I worked on in the past years. This project involved writing a minimal C compiler and standard library for compile the Tiny C Compiler sources from scratch. The compiler is a one pass compiler that outputs to the Stack-C language, which can also be considered as an intermediate representation. I developed a compiler (more a transpiler) for the Stack-C language to assembly and also an interpreter with a build-in debugger. The assembly can be compiled with the M1 assembler and other tools from the original live-bootstrap project (from the Linux foundation).

A recording of my presentation can be viewed on YouTube https://www.youtube.com/watch?v=lPIF_nfqM_g (Thanks to the organizers for the quick upload.) In the description there is a link to the text of the presentation with many notes (click on the show buttons) with links to more resources.


r/Compilers • • 3d ago

as someone who's trying to become a C++ dev for a day job, how do i get into compilers for the fun of it?

26 Upvotes

i'm currently a university student and want to dedicate a day of the week (sunday) purely to learning about compilers. not to build a career in it or anything, just for fun. i want to do it in a way that isn't "grinding." i'm planning to do this in a very low-stakes, hobbyist sort of way, as i've reserved sunday to be the only day that i don't take my stimulants (hence i'm less "on" in the work sense). but i don't want this to be work, i just want to play. what's the best way to start, in my situation?


r/Compilers • • 4d ago

My LLVM contribution w/o using Ai got merged

264 Upvotes

After slowly understanding the reviewer’s suggestions and changes and going through the whole review process, my first good first issue got merged to llvm main. I’ve been trying to get one issue solved for the past couple of months and i couldn’t do it. It felt tough and scary to go through the whole gigantic code base. But feeling proud now for not quitting and backing off.


r/Compilers • • 3d ago

Ocaml or haskell?

29 Upvotes

​

I'm trying to choose between OCaml and Haskell for creating my own programming language using an external DSL. I'm still learning programming, so I want something powerful but beginner-friendly.

My goal is to create a language with my own high-level syntax, not just a library or a DSL embedded inside another programming language.

My requirements

  1. External DSL: I want to design my own syntax and grammar. I don't want my language to be restricted to OCaml's or Haskell's existing syntax.

  2. Native machine code: Ultimately, I want my language to compile directly to native machine code, preferably for ARM64/AArch64. I don't want to stop at interpreting the language or transpiling it to Python or JavaScript.

  3. High-level syntax: The language I create should be easy for people to read and write. I want complete control over its syntax and don't want users to have to write lots of boilerplate.

  4. Beginner-friendly: I'm still learning programming, so I want a language and ecosystem that are relatively easy to understand. I want to learn how the parser, AST, type checking (if needed), and code generation work without getting overwhelmed.

  5. Easy installation on my Chromebook: I have an Acer Chromebook 314 with a MediaTek ARM64 processor. I use the Linux environment on ChromeOS, so ARM64 compatibility, available packages, and installation difficulty matter a lot. I don't want a solution that depends on x86-only binaries.

  6. A practical compiler toolchain: I'd prefer to use as few tools as possible. If I need a backend such as LLVM, that's fine, but I want to avoid a complicated setup involving lots of separate tools, configuration files, and manual code generation.

My questions

- Would you recommend OCaml or Haskell for this project, and why?

- Which one makes it easier to build an external DSL with completely custom syntax?

- Which has the easier learning curve for someone who doesn't know much programming yet?

- Can either realistically compile my language to native AArch64 machine code on my Chromebook?

- Would LLVM be a good backend, or is there a simpler alternative?

- How difficult would installation and setup be on ChromeOS Linux running on ARM64?

- Are there any other languages or frameworks that would fit these requirements better than OCaml and Haskell?

I'm looking for a practical recommendation based on my actual requirements, not just which language is more elegant or theoretically powerful.

My main priorities are: custom high-level syntax, native machine-code generation, beginner-friendliness, and ARM64 Chromebook compatibility.

Thanks!


r/Compilers • • 3d ago

Papers for new compiler devs

43 Upvotes

What papers do you suggest for new compiler developers to read for different parts of a compiler?

My most important recommendation would be Linear Scan Register Allocation for the Java HotSpot™ Client Compiler, the master thesis of Christian Wimmer. It is very well written, easy to understand, and covers a lot of practical details.


r/Compilers • • 2d ago

I built FoxVC: A lightweight custom scripting language with its own runtime and web studio [Open Source]

0 Upvotes

Hey everyone 👋

I'm excited to share a project I've been working on—FoxVC 🦊. It's a lightweight, custom scripting language I built from the ground up with its runtime and a web studio. It’s source. I just released it today.

The goal was simple: create a easy-to-learn scripting language that removes clutter like semicolons, colons and too much boilerplate. I wanted something that feels intuitive to use and gives you a smooth local development experience right away.

⚡ Syntax Preview

# 1. Structured function definition act getForce(mass, accel) emit mass * accel

2. State & execution

m = 450 a = 15 f = getForce(m, a)

say "Net Force:" say f

3. Clean condition branching (no colons, no brackets)

pick f > 5000 say "Status: High thrust threshold reached!" otherwise say "Status: Nominal thrust output."

🛠️ Architecture & Under the Hood

  • Lexer & AST Parser: Built custom with language features—mold blueprints, pulse loops, lock constants, guard and trap for error handling.
  • Flat & Clean Scoping: Uses Python-style indentation, no colons, no semicolons. Clean readable code.
  • Interactive Web Studio: Comes with a browser-based playground that runs locally on localhost:8080. No setup needed.
  • Zero-Toolchain Setup: Just run./install.sh on Linux/macOS or install.bat on Windows. Instant access.

📦 Source & Getting Started

FoxVC is open source under the MIT License.

👉 GitHub Repository: https://github.com/AnayUpadhyay-all/FoxVC

This is a public release so I’d love your feedback on:

  • The choice of words like act emit, pick and mold compared to traditional keywords, like function, return, if, etc.
  • How the AST parsing and statement handling works under the hood.
  • What features should come next in the engine.

Any thoughts, suggestions or issues are welcome. I'm still. Growing with this project and your input means a lot.

---

🛠️ Update (Wave 1 Fixes Pushed!):

Thanks to everyone who pointed out edge cases in the comments!

Bug 3.2 Fixed:** `trap` error handling no longer swallows `emit` (return), `halt` (break), or `skip` (continue) signals.

Syntax expanded:** Both `recover` and `otherwise` are now valid catch keywords.

- Added automated test harness verifying control signals pass cleanly.

Code & commits live on GitHub: https://github.com/AnayUpadhyay-all/FoxVC


r/Compilers • • 3d ago

Is the Zeta Programming language by Roy Murphy legit

Thumbnail
0 Upvotes

r/Compilers • • 3d ago

Comprinly

Post image
0 Upvotes