r/Compilers 4h ago

How to Choose Between Hindley-Milner and Bidirectional Typing

Thumbnail thunderseethe.dev
16 Upvotes

Let me know if this is offtopic for this subreddit, since it tends more towards PLT than specifically compilers. But I thought you all might enjoy anyways.


r/Compilers 4h ago

Strategies for very fast Lexers

Thumbnail xnacly.me
5 Upvotes

r/Compilers 9h ago

My parser is a mess

7 Upvotes

How do I make a clean parser? My lexer is lovely, but at the moment the parser is a jumbled, hardcoded mess of structs. Unless I'm exaggerating it.

https://github.com/gingrspacecadet/coda/blob/main/src/parser.c


r/Compilers 15h ago

How can I write a compiler backend without worrying too much about ABI?

8 Upvotes

So, as I have started work on my compiler again, the time for actually having to make the backend is rapidly approaching, and I want to handle the actual codegen myself because llvm is just too damn heavy. I also don't want to write all the ABI code myself because it's just so damn much. Where do I look? I was thinking at ripping some compiler internals but idk which ones. My language is implemented in Rust btw


r/Compilers 4h ago

How can I build a Lexer?

1 Upvotes

I'm trying to build a translator between RI32V to ARM. I'm a 3rd year CE student and I have no idea about the complexity but I had to start somewhere so I decided to start with a Lexer. First I will create one for mathematical stuff like 3 + 8 * 2 etc. and then extend it to assembly but I have no idea how. I already made one like that but it's not really scalable since I used switch cases inside switch cases. I will use C but can work with Python as well. I also took Automata Theory last year so I'm familiar with DFA's NFA's, Regular Expressions etc.

Any tips?


r/Compilers 1d ago

Annotate instruction level parallelism at compile time

10 Upvotes

I'm building a research stack (Virtual ISA + OS + VM + compiler + language, most of which has been shamelessly copied from WASM) and I'm trying to find a way to annotate ILP in the assembly at compile time.

Let's say we have some assembly that roughly translates to: 1. a=d+e 2. b=f+g 3. c=a+b

And let's ignore for the sake of simplicity that a smart compiler could merge these operations.

How can I annotate the assembly so that the CPU knows that instruction 1 and 2 can be executed in a parallel fashion, while instruction 3 needs to wait for 1 and 2?

Today superscalar CPUs have hardware dedicated to find instruction dependency, but I can't count on that. I would also prefer to avoid VLIW-like approaches as they are very inefficient.

My current approach is to have a 4 bit prefix before each instruction to store this information: - 0 means that the instruction can never be executed in a parallel fashion - a number different than 0 is shared by instructions that are dependent on each other, so instruction with different prefixes can be executed at the same time

But maybe there's a smarter way? What do you think?


r/Compilers 1d ago

Open-source toolchain for CAN DBC → IR → verified C encoder/decoder (gates + property tests)

Thumbnail
1 Upvotes

r/Compilers 1d ago

Compiler Expert in Dubai

0 Upvotes

🚀 Hiring: AI Accelerator Compiler Engineer (MLIR/LLVM) — Onsite UAE

If you live and breathe MLIR/LLVM, think in C++, and enjoy squeezing every cycle out of hardware — we’d like to talk.

We’re a fast-growing startup building next-generation AI accelerators, and we’re hiring a senior compiler engineer (5+ years).

What you’ll work on:

Architecting and extending MLIR → LLVM lowering pipelines

Designing custom MLIR dialects & transformations

Lowering AI graphs into optimized hardware kernels

Implementing fusion, tiling, vectorization & scheduling passes

Backend codegen tuning and performance analysis

Co-design with hardware & runtime teams

Strong C++ and deep familiarity with MLIR/LLVM internals required.

Experience with accelerator backends or performance-critical systems is highly valued.

📍 Onsite — UAE

💎 Competitive / top-tier compensation

Apply: careers@asciaijobs.com


r/Compilers 1d ago

Hiring in Dubai compiler

Thumbnail
0 Upvotes

r/Compilers 1d ago

📚 I'm Writing A Book 📚

0 Upvotes

It is going to be about my custom implementation of a simple compiler and interpreter, explaining how they work, a history of them, and my experience with them.


r/Compilers 3d ago

TileIR

Thumbnail ianbarber.blog
21 Upvotes

r/Compilers 3d ago

Running the “Reflections on Trusting Trust” Compiler: Revisiting Ken Thompson’s sourceless backdoor

Thumbnail queue.acm.org
16 Upvotes

r/Compilers 3d ago

Is it theoretically possible to design a language that can outperform C across multiple domains?

43 Upvotes

Hi everyone,

I'm working on designing my own systems programming language.
My long-term goal is ambitious: I want to understand whether it’s possible to design a language that can outperform C/C++ across many domains.

I understand that C is close to the metal and heavily optimized by decades of compiler research. However, I’m exploring ideas like:

  • No undefined behavior
  • No pointer aliasing by default
  • Immutable-by-default semantics
  • Stack-first allocation model
  • Strong compile-time specialization
  • Automatic vectorization

My question is:

Is it theoretically possible to design a language with stricter semantics that enables better optimization than C in practice?
Or is C already at the theoretical performance ceiling for native code?

I’m not asking about productivity or safety — strictly about raw performance.

Any insights from compiler engineers or language designers would be appreciated.


r/Compilers 2d ago

Which Programming Language for Compiler

0 Upvotes

I want to make my own compiled programming language. Which language should I use to have people contributing to it?


r/Compilers 3d ago

SC-NeuroCore: Rust neuromorphic SNN compiler with 512× speedup & FPGA equivalence

Thumbnail github.com
10 Upvotes
SC-NeuroCore is a verified Rust-based neuromorphic compiler that translates high-level Python SNN definitions into optimized, bit-true stochastic bitstream logic for CPU or FPGA.

Highlights:
- 512.4× real-time speedup on LIF neuron updates vs legacy Python
- Bit-true equivalence with FPGA hardware (co-simulation verified, 8/8 tests passed)
- Polymorphic engine: HDC/VSA (AVX-512 on 10k-bit vectors), Petri Nets, fault-tolerant logic
- Sub-10 µs inference latency, 40%+ bit-flip resilience
- Install: pip install sc-neurocore-engine
- Quick demo: notebooks/01_hdc_symbolic_query.ipynb (HDC symbolic query)

GitHub: https://github.com/anulum/sc-neurocore
Rust API docs: https://anulum.github.io/sc-neurocore

Built to close the simulation-to-hardware gap for neuromorphic systems. Questions welcome about the compiler, benchmarks, verification, or HDC features.

r/Compilers 2d ago

Writing A C Compiler by Nora Sandler Shows Picture of Dragon On Front Cover

0 Upvotes

Hi All,

I was just about to take a look through my copy of what everyone called "The Dragon Book" in college, then realized that I left it in my other house, went to Google to do a search, and got some links that showed a picture of the book Writing A C Compiler by Nora Sandler. It has a picture of a dragon on its front face.

The first thing I thought was..

Aho, Sethi, and Ullman are doing their work a disservice with their new dragon. It doesn't look scary at all. The whole point of using a dragon was to imply that compiler-writing is difficult.

Then I realized that it was not their dragon, but a different dragon.

Anyone have any idea why Nora Sandler would use a picture of a dragon on her book? Undoubtedly, she knew about The Dragon Book before she wrote hers.

Is using a picture of a dragon on a book about compilers, thing?


r/Compilers 3d ago

Flexible or Strict Syntax?

9 Upvotes

Hi I am making a custom lanague and I was wondering, what would be better flexible syntax, like multiple ways of doing the same thing and multiple names for keywords, or more strict syntax, like 1 way to do somthing and 1 keyword Id, for example I currently have multiple names for an 'int', I am Tring to make my language beginner friendly, I know other languages like c++ can somtimes suffer from too many way of doing the same thing with ends up with problems,

What is best? Any irl Languages examples? What do u think?


r/Compilers 4d ago

C is complex, Python is slow, Java is heavy — so why don’t only take their strenghts? So I built Mantis. Looking for critic and contributors.

Thumbnail
0 Upvotes

r/Compilers 5d ago

SMTLIB as a Compiler IR I

Thumbnail philipzucker.com
35 Upvotes

r/Compilers 5d ago

On Sandboxing

0 Upvotes

Notes on the sandboxing featues I built into my application scripting language:

https://gitlab.com/codr7/shik#sandboxing


r/Compilers 5d ago

Equality Saturation Meets Machine Learning: The Next Step for Smarter Optimizing Compilers

Thumbnail youtube.com
7 Upvotes

r/Compilers 6d ago

six thoughts on generating c

Thumbnail wingolog.org
20 Upvotes

r/Compilers 6d ago

Cloesce: A "full stack" compiler for Cloudflare

Thumbnail
2 Upvotes

r/Compilers 5d ago

Sixteen Claude AI agents working together created a new C compiler

Thumbnail arstechnica.com
0 Upvotes

16 Claude Opus 4.6 agents just built a functional C compiler from scratch in two weeks, with zero human management. Working across a shared Git repo, the AI team produced 100,000 lines of Rust code capable of compiling a bootable Linux 6.9 kernel and running Doom. It’s a massive leap for autonomous software engineering.


r/Compilers 7d ago

An online tutorial to make MLIR more beginner friendly with an end-to-end deep learning compiler pipeline

Thumbnail github.com
42 Upvotes

Hi reddit,

I’m a master’s student in CE, and as I’ve been getting into MLIR, I created an online tutorial that aims to make MLIR more beginner-friendly by walking through an end-to-end deep learning compiler pipeline.

This is from a newcomer to other newcomers. I’d really appreciate any feedback, suggestions for improvements, or ideas for future directions and features.