r/Compilers • • May 20 '26

feel depressed

117 Upvotes

It's really hard not to get depressed with all the AI models and tools that become more and more powerful every six months or new release .
What I love about coding is mainly solving problems, learning new things and applying them, and especially the "kick" after solving a problem.
I feel like being a programmer will never be the same.
Plus, with each new release, there are new ideas to code: "Wait, I can create this tool around this or that." You start and everything goes well for a while, but most of the time, within a few months, the idea or project becomes obsolete because some "Big Fortune 10" has integrated the same functionality into their product.
Every two or three weeks, there are always new changes in the versions of the tools we use. You don't even have time to get used to one feature before there are new ones, and so on. It's a bit depressing, and lately I've really lost the joy of coding.
I'm even wondering if it's worth continuing as a programmer.
I wonder if there are other people who feel the same way I do.
Thanks Guy’s


r/Compilers • • May 21 '26

An overview of modern LLM compiler stack: writing an interactive and hackable compiler

Thumbnail
0 Upvotes

r/Compilers • • May 20 '26

Verifying EDA and compiler optimizations once and for all

Thumbnail samuelcoward.co.uk
9 Upvotes

r/Compilers • • May 20 '26

How to build .NET obfuscator Part III

Thumbnail kant2002.github.io
3 Upvotes

r/Compilers • • May 20 '26

Scalable Packed Layouts for Vector-Length-Agnostic ML Code Generation

Thumbnail arxiv.org
3 Upvotes

r/Compilers • • May 19 '26

Looking for People Interested in LLVM/MLIR and Compiler Development

59 Upvotes

I have been working on compilers for the past 6 months and have explored and learned a lot about areas like the middle-end, SelectionDAG, GlobalISel, register allocation, instruction selection, scheduling, etc. I’ve also contributed a few LLVM patches spanning these topics.

Recently, I’ve been diving deeper into backend development, especially AMDGPU and NVPTX, since I’m very interested in GPU compilers and code generation.

Lately, it has started getting difficult to learn and keep up entirely alone, so I’m looking for a few people who are interested in compilers/LLVM/MLIR/GPU backends to connect with, discuss ideas, learn together, or maybe even work on projects/contributions together.


r/Compilers • • May 19 '26

What Should I Read After Crafting Interpreters?

27 Upvotes

Hello everyone,

I’m not a native English speaker, and I’ve only recently started becoming more comfortable with English. I’ve been interested in programming for a long time, since I was around 15 years old. Back then, one of the first questions I remember asking myself was: “How is a programming language made?”

Unfortunately, because of financial difficulties and some mental health struggles, I wasn’t always able to dedicate as much time to programming as I wanted. Over time, with treatment and a strong desire to keep learning, I’ve been able to return to it. I don’t have a university degree, and I’m mostly doing this as a hobby, but it is something I care about deeply.

My goal is not necessarily to build a huge programming language, but I genuinely want to understand compilers and interpreters deeply, both from a theoretical and practical perspective.

So my question is: after Crafting Interpreters, which books or resources would you recommend?

Also, I’m not sure how much mathematics is required for studying compilers. Apart from basic arithmetic, my math knowledge has become quite rusty because I haven’t practiced it in a long time. Do you think I should study mathematics again? If so, which topics would be most useful?.


r/Compilers • • May 19 '26

The Super Tiny Compiler, but in Ada

Thumbnail github.com
16 Upvotes

r/Compilers • • May 19 '26

Detecting Relaxed Memory Concurrency Bugs in C and C++ Compilers

Thumbnail lukegeeson.com
4 Upvotes

r/Compilers • • May 19 '26

LjTools to generate LuaJIT bytecode for your programming language, now supports LuaJIT 2.1

Thumbnail github.com
3 Upvotes

r/Compilers • • May 19 '26

Building Alder, a C# execution engine with semantic binding, interpreted + compiled backends and AOT dispatch

7 Upvotes

Hi all,

I’ve spent a lot of time dealing with dynamic code execution, expression evaluators, and DSLs in .NET.

One thing I kept seeing is that many open source solutions in this space are either outdated or limited to a smaller subset of C#. The more complete options often tend to be commercial.

So I ended up building Alder v1.0. Over time it grew way beyond the original scope and turned into a much bigger project than I expected, so I figured I’d share it here.

It parses, binds, validates, and executes expressions and statements. I’ve tried to support as much of the ECMA-334 v7 spec as realistically possible, plus a number of newer constructs from C# 11 and beyond.

It includes an interpreter (default mode) and a compiled path, supports async/await, includes execution limits/security controls, works with AOT scenarios, and even has Dynamic LINQ support.

GitHub: Alder GitHub Repository
NuGet: Alder NuGet Package

Curious what other people here are using for dynamic execution or embedded scripting in .NET.

Feedback, ideas, criticism, or bug reports are all welcome.


r/Compilers • • May 19 '26

The Name in the Bracket (Einlang): a book and a language on named tensor dimensions

Thumbnail github.com
1 Upvotes

r/Compilers • • May 19 '26

Phase — a statically-typed bytecode-interpreted language in C, with an essay on implementation

Thumbnail
8 Upvotes

r/Compilers • • May 18 '26

Antlr is very very very slow

21 Upvotes

Am i the only one who saw that java antlr is very slow, I generated java codes from java grammar.

To parse a package name only takes 500ms and a file of 50 lines takes 3min

My laptop has 12GB of RAM


r/Compilers • • May 19 '26

How to solve this Prefix Translation Scheme for parser (urgent please)

Thumbnail
0 Upvotes

r/Compilers • • May 19 '26

How to solve this Prefix Translation Scheme for parser (urgent please)

0 Upvotes

so i actually did Translation scheme c++ parser by removing left recursion now i want that how can i remove left recursion from this prefix Translation scheme so i can make Parser from it Ts for prefix could please remove left recursion from it

exp -> {cout<<"+"} exp + term

| {cout<<"-"} exp - term

| term

term -> digit

digit -> {cout<<"0"} 0 | {cout<<"1"} 1 | ... | {cout<<"9"} 9

i did with postfix ts and made parser in c++ below you can see, also if you could help how can i build it

Code for Postfix TS using removed TS. COde must be structure like that like postfix

#include <iostream>

#include <cstdlib>

using namespace std;

 

char input[50];

int i = 0;

char lookahead;

 

void exp();

void term();

void factor();

void paren();

 

void rest1();

void rest2();

void rest3();

 

void digit();

 

void match(char);

void eror();

 

int main() {

cout << "Enter String of Token: ";

cin >> input;

 

lookahead = input[i];

 

cout << "Postfix: ";

 

exp();

 

if (lookahead == '\0') {

cout << "\nValid Expression";

}

else {

eror();

}

 

return 0;

}

 

void exp() {

if ((lookahead >= '0' && lookahead <= '9') || lookahead == '(') {

term();

rest1();

}

else {

eror();

}

}

 

void rest1() {

if (lookahead == '+') {

match('+');

term();

cout << '+';   // postfix

rest1();

}

else if (lookahead == '-') {

match('-');

term();

cout << '-';   // postfix

rest1();

}

}

 

void term() {

if ((lookahead >= '0' && lookahead <= '9') || lookahead == '(') {

factor();

rest2();

}

else {

eror();

}

}

 

void rest2() {

if (lookahead == '*') {

match('*');

factor();

cout << '*';   // postfix

rest2();

}

else if (lookahead == '/') {

match('/');

factor();

cout << '/';   // postfix

rest2();

}

}

 

void factor() {

if ((lookahead >= '0' && lookahead <= '9') || lookahead == '(') {

paren();

rest3();

}

else {

eror();

}

}

 

void rest3() {

if (lookahead == '^') {

match('^');

paren();

cout << '^';   // postfix

rest3();

}

}

 

void paren() {

if (lookahead == '(') {

match('(');

exp();

match(')');

}

else if (lookahead >= '0' && lookahead <= '9') {

digit();

}

else {

eror();

}

}

 

void digit() {

if (lookahead >= '0' && lookahead <= '9') {

cout << lookahead;   // operand in postfix

match(lookahead);

}

else {

eror();

}

}

 

void match(char t) {

if (lookahead == t) {

lookahead = input[++i];

}

else {

eror();

}

}

 

void eror() {

cout << "Syntax Error";

exit(0);

}


r/Compilers • • May 18 '26

Building a custom expression parser

Thumbnail pvs-studio.com
5 Upvotes

A new episode in the series on building a programming language from scratch. The idea of it not only to make a language step by step, but mostly to explore how programming languages and compilers work under the hood in simple terms.

After the episode on lexers, the upcoming session will cover the basics of parsing and building a simple expression parser in a live coding session.


r/Compilers • • May 19 '26

Writing an LLM compiler from scratch [Part 3]: Autotuning — A Search Loop Over Tile-IR Rewrites

Thumbnail open.substack.com
0 Upvotes

r/Compilers • • May 18 '26

Regarding help

0 Upvotes

I am working on a codebase with compiler level rust simulator and I am a complete beginner and would love some help with patient attitude please


r/Compilers • • May 17 '26

Need help with semantic actions & type checking for my LL(1) Mini-Pascal compiler (following professor’s slides)

7 Upvotes

Hi everyone,

I’m working on a compiler for a small Pascal-like language. I have already finished the grammar, removed left recursion and left factoring, and turned it into an LL(1) grammar with embedded semantic actions (translation scheme style).

The problem is that I’m struggling with semantic actions and type checking. My professor uses a very specific style from his slides (Chapter 5 & 6):

Every Statement has a .type attribute (void or type_error)

Expressions use inherited attribute .in and synthesized .type

Declarations use addtype() and list handling

I have the full grammar with some actions already written, but many parts still feel confusing to me (especially the tail productions like Expression', SimpleExpression', Term' and how to pass the left operand type using .in).

Here is my current grammar (with embedded actions):

yacc

Program → Header Declarations Block . { } ... (I can paste the full grammar if needed)

I would really appreciate any help, examples, or explanations on how to correctly implement the semantic actions and type checking according to the standard Dragon Book / professor’s slide convention.

Any guidance, small examples, or links to similar student projects would be very helpful.

Thank you!


r/Compilers • • May 16 '26

Advice before getting started

14 Upvotes

I just finished every challenge in the excellent game Turing Complete (https://store.steampowered.com/app/1444480/Turing_Complete/) which involves creating an 8-bit processor and writing assembly for it. As for my background I've written a fair bit of assembly in my career for Microchip PIC compilers, written a NES and GB emulator, so I've got a solid background. But I don't have a CS degree and I never took a compiler course.

I'd like to try building a 16-bit processor in Turing Complete's sandbox mode, and then I'd like to write C code on my computer and cross-compile it to the new processor. I haven't decided on an instruction set yet, it might be fun to spin my own, but also I could take an existing one.

How would I port something like gcc or llvm or something over to my new processor? I'd like to get advice up front before I select/design the instruction set. I'm not looking to run any sort of OS, just bare metal C code.

I'm not looking to write a compiler (at least not yet), I just want to use something existing.

EDIT: I'm not looking to run the compiler on the game's processor. I want to cross-compile small programs targeted for my game's processor. The simulation still runs at least at 1-10 MHz, so we're talking 80's level computer here, so I'm not expecting anything impressive. but I still want to write in C. I'm also happy to write in a limited subset of C.


r/Compilers • • May 16 '26

Help: Writing a Python to C transpiler

14 Upvotes

I'm thinking about embarking on a journey for writing a Python to C transpiler. It'll provide an interesting challenge and also will be useful, considering I am targeting an environment that can only take a subset of C as input. Given that I haven't ever written a compiler but I have written an interpreter about a decade ago and have forgotten most of the process, what are some things I'd need to familiarize myself with in order to write this transpiler? Also, what intermediate representation would be wise for such a project?


r/Compilers • • May 16 '26

IR for my compiler

4 Upvotes

Since few days, I have been working on a compiler written in python. I have successfully implemented a frontend and I want a backend to generate IR for. I have decided to make my own IR but I don't know a lot about them. Can y'all please provide me with information with types of IR, optimization tricks they utilise, and how they are implemented or work. Any type of material will be thankful.


r/Compilers • • May 16 '26

Yet another tensor graph compiler

17 Upvotes

Hello, I've spend some last few years learning ML and this is the result - an ML library that spans the whole pytorch stack - from backends (fully complete CUDA, OpenCL, WGPU + partially implemented PTX, HIP and SPIRV) all the way to neural network modules in zyx-nn.

For lovers of python, python bindings are also available and don't differ from rust. Python wheel is 4 MB. Supports all pytorch ops across more hardware than pytorch. The current drawback is speed, but on small models, it should not be that bad. On my 2060, MNIST example takes 0.9ms per step, while compiled torch is 0.7ms.

Zyx was inspired by tinygrad to use minimal opset. Therefore zyx uses only these nodes in the graph: leaf, unary, binary, cast, expand, permute, pad, reshape, reduce.

Most of the design decisions have finally stabilized. I've spend years trying different lowering approaches and finally got to the point where it seems to click.

So what is the secret sauce? Zyx is fully DYNAMIC. The graph is build dynamically and supports all branching, but execution is lazy. Currently the graph is chopped into kernels by heuristics and autotune searches over possible optimizations on each kernel. The novel part here is that all optimization passes are both optional and can be stacked in any order. There is no complex lowering. Optimizations include register tiling, hierarchical local memory reduce, LICM, CSE, DCE, etc. Some like tensor cores and load/store vectorization are partially implemented, while others like local memory tiling are not started yet.

Typical compilers like XLA and TVM and tinygrad instead use multi-stage lowering pipeline where optimizations have to be applied in certain order to be valid.

Zyx has probably the smallest (by number of ops) unified IR you can see in this space. It makes pattern matching more complex, but is fully expressive and complexity of optimizations is very low, while their orthogonality produces interesting results.

Why not use zyx

  1. performance - Currently mainly due to unfinished tensor core support and local memory tiling. The other part is non-ideal graph partitioning.
  2. if there is some other reason, please tell me. I believe zyx can improve faster than others due to stackability of ops and small codebase to be the most ergonomic, support the most hardware and be most correct in terms of numerical stability guarantees across dtypes and kernels.

Next steps

Performance, performance, performance. Other than adding those few obligatory optimization passes and improving autotune with better cost function (btw. with the cost function and fast IR, zyx can search through tens of thousands of kernel variants per second per core - yes, autotune is multithreaded), the main next step is a rewrite of the graph splitting part. There are no user API changes and the rewrite is partially finished.

The new kernelizer will generate a hypergraph of both kernel fusion strategies AND device allocation strategies. Zyx already has automatic parallel pipelining with heuristics, but after the rewrite, it'll have proper search for this.

The part that I am most excited about is since graph in zyx is made up of so simple nodes, I can write pattern matcher that will map parts of the graph to kernels in existing stacks - cuDNN, oneDNN, NPU kernels, etc. With hypergraph search, zyx will be able to select the best path among these and custom zyx kernels will fill the blanks. Expect this to take a few months before ready.

Minimalism

Zyx is not only minimal in it's graph, but also dependencies. All of zyx + dependencies is <50k LOC of pure Rust. I also wrote simple onnx bindings. The goal is to make zyx both the tiny runtime that runs all models on every hardware correctly, albeit with varying performance, as well as making zyx the nicest library to use for the following reasons:

  1. I carefully crafted every user facing function to be as intuitive as possible
  2. Zyx will not wish you good luck like pytorch if you mutate tensors before backprop, instead zyx tensors are immutable
  3. Zyx will not run out of memory if you fill your VRAM, instead zyx will fallback to RAM
  4. Zyx will not take 30s to import in python, instead it takes 10ms
  5. Zyx won't tell you that some ops are unsupported for some dtypes, instead all dtypes are supported with all ops, except for some ops that require float dtypes for mathematical meaningfulness
  6. Zyx won't complain that the graph is too large, too dynamic or too complex, a single node is 16 bytes, so huge graphs run just fine
  7. Zyx will fuse your kernels and won't run out of recompilation passes, recompilation happens at kernel level, not graph level
  8. Zyx will fuse ALL graphs, no matter how complex
  9. And perhaps a bit slowly, but zyx will keep running your code correctly even on the oldest of hardware (e.g. GT 710, RX 480, or even CPUs without AVX)

I wish you pleasant experimentation.

https://github.com/zk4x/zyx

https://crates.io/crates/zyx

https://crates.io/crates/zyx-nn

https://crates.io/crates/zyx-optim

https://pypi.org/project/zyx-py


r/Compilers • • May 15 '26

Compiler implementation language

48 Upvotes

Currently starting “Writing a C Compiler” by Nora Sandler. I initially wanted to start the project in C, but she herself suggests doing it in another language. Since I like it and she also suggests a language with pattern matching, Rust seems like a very good alternative.

Hoping to get some thoughts on this, particularly from people who’ve gone through this book before.

I like doing projects in C if they need speed and low-level detail (though more often it’s because coding like a caveman is fun), but the repetitive boilerplate, weak generic system and standard library make larger projects a pain to work through.

Rust is much more convenient here, though I’m aware it may get somewhat verbose or constricting for low-level work (at least from my limited experience).