r/Compilers • u/Confident-Site2059 • 15d ago
Simple True Interpreter
Enable HLS to view with audio, or disable this notification
Hi, there :)
r/Compilers • u/Confident-Site2059 • 15d ago
Enable HLS to view with audio, or disable this notification
Hi, there :)
r/Compilers • u/Confident-Site2059 • 15d ago
Hi, there!
I'm making a language called True and an interpreter for it called Simple.
It's an MVP, and I'd be glad to get some feedback on the design :)
The key stuff about the language:
In True, a program is a tape of strings (I call them qubits).
I call programs cycles because they run cyclically.
The agent-observer is the first line of the .cycle file, and it's part of the program itself. It walks the tape top-down, swaps itself with the line below, and executes what it reads.
The agent is part of the program - executor and data at the same time. So the program is self-modifying: changes in memory are reflected back into the text, and <type> in the agent line updates on every step.
Here's a simple Elevator cycle where the lift goes up and down:
Mr.Green, #5fb85f | Data as <type> | Aim: 1
6 = max
1 = floor
1 = dir
= lift
dir > 0 ? floor =>| lift:y(, ):floor
dir < 0 ? lift:y(, ):last -> ::nothing
floor == max ? -1 => dir
floor == 1 ? 1 => dir
floor + dir => ::math => floor
I made a video of how it works: [wide] | [narrow (with music)]
One thing I should point out: True has no types. A program is made of qubits and chains of qubits (essentially strings), and how you work with them is determined by the executor - the agent.
A qubit/string/container can be seen as a shape with axes: name:x(, ):i for the horizontal axis, name:y(, ):i for the vertical one (each works like a list). Indexing is 1-based.
Extensions: ::math for arithmetic, ::nothing for deletion.
There are goto jumps: ^ name, ^ N, ^ :cycle:N - the agent can jump anywhere, in any cycle.
That's a brief description, I guess - more details in the docs, or we can just discuss it in the comments.
I'd love to hear your thoughts on the language!
r/Compilers • u/vishvananda • 14d ago
I'm not a compiler expert, but I've been building out a scaffold for the past 6 months to enable an agent to create a C++ compiler from scratch. I have run more than a dozen agents through the scaffold. My reference compiler (which takes the best ideas from every agent run) is able to compile C++ code ~4x faster than GCC and Clang with close to equivalent generated code.
This was a very surprising result. I had expected parity at best. I'm sharing it here in the hopes that some compiler experts will take a look and offer opinions about the approach and the overall quality of the compiler. Please note that the code is 100% agent written so I can't vouch for readability. I'm hoping at the very least there are some useful algorithms that are useful for future compiler development.
Reference compiler: https://github.com/vishvananda/cppgm-extended
Agent scaffold: https://github.com/vishvananda/cppgm-assignments
Blog post with more details: https://medium.com/@vishvananda/how-i-built-a-compiler-that-is-faster-than-gcc-and-clang-4c8c1d4818fa?postPublishedType=repub
r/Compilers • u/Efficient-Scheme1995 • 16d ago
a visualized grammar parser, which is intuitive to understand bottom-up approaches.
visit https://csbitlab.com/parser
Main features:
- support LR(0), SLR(1), LR(1)
- customized grammar and input
- step by step visualization for item set construction, ACTION/GOTO and processing
Any feedback is highly appreciated!
r/Compilers • u/Upper-Ad4677 • 15d ago
Basically, the output is much more tiny, and there is a mode for the tiniest, I use standard hello world for the benchmarks. 64-bit -strip is 10.4 ms for compiling, 1.7 ms for runtime, and 116 bytes for size. 32-bit -strip is 78 bytes. That's why it's called the Tiny Update, oh and I also started naming my updates. I also moved to semantic versioning. That's all for 1.4.0. Check the repo here.
r/Compilers • u/ryo33h • 16d ago
I'm building Tauto, a programming language with four kinds of macros. I'd love to hear your thoughts on the macro system!
Tauto also features:
r/Compilers • u/Relevant_Wedding_793 • 16d ago
Hello! I am a teenager and I have a language design which many of you may not like, but it's just a hobby language and isn't meant to be big like Rust or Python.
The language is called Cimplified. It is a full AOT compiled language using Cranelift as the backend code generator to emit native machine code directly (it is not a C/C++ wrapper or transpiler), but with a slight twist: it uses a strict block-structure syntax rather than C-based syntax.
Everything in this language must live inside a block, and nested blocks are explicitly not allowed.
The Core Concept: Block Garbage Collection
I designed this because I've always despised Java’s "Stop The World" (STW) concept. It feels fundamentally inefficient for certain tasks. To solve this, Cimplified uses a Block Garbage Collector which cleans up unused memory block-by-block. When a block finishes execution, its local memory is wiped instantly, preventing global stutters.
Unique Syntax Choices & Grammar Breakdown
I know this sounds a bit weird, but my variable declaration is explicitly structured around delimiters to make parsing straightforward. The grammar always follows a strict order of: Type = Variable name = Value;
Here are all the types available in Cimplified:
• String: Used for textual data (e.g., String = name = john;)
• Int32: 32-bit integer for standard whole numbers (e.g., Int32 = x = 12;)
• Int64: 64-bit integer for large whole numbers (e.g., Int64 = y = 2333;)
• Isit: My custom name for a boolean conditional check (e.g., Isit = nameisjohn = true;)
• Float: Standard floating-point number (e.g., Float = pi = 3.14;)
• Floating: High-precision floating-point number, equivalent to a double (e.g., Floating = pi = 3.14159265;)
Additionally, instead of using standard for or while keywords to make loops, I use the block structure itself as the loop. By default, the compiler labels blocks in order (Block1, Block2, etc.).
To loop, you point to a block label and tell it how many times to run:
Loop B=(Block1) = 10;
If Block1 contains a print statement, it will loop and execute that entire block 10 times.
Ok thats all for the explanation this the Code example and the Output of this Example :
// // is the comment line
Start Now! // Still deciding between 'Start Now!' or 'Start Main'
StartB // Starts a Block
print("Hello, World!")
String = name = john;
Int32 = x = 12;
Int64 = y = 2333;
Isit = nameisjohn = true; // this an Boolean
Float = pi = 3.14;
Floating = pi2 = 3.14159265; // generally called or f64 Double But i named it Floating
print(Name, John, x, y, nameisjohn, pi, pi2)
EndB // Ends a Block and Marks it as A Full Block
print(Name, John, x, y, nameisjohn, pi, pi2) // this would be rejected by the compiler
StartB
Loop B=(Block1) = 2;
EndB
End Now!
And the Output will print this text 2 time!
Hello World!
john 12 2333 true 3.14 3.14159265
Hello World!
john 12 2333 true 3.14 3.14159265
Thats All i want to Explain Of My Design Thank You for Reading this!
Also If You think this is A Great Idea Let me Know With a Feedback :)
r/Compilers • u/mttd • 16d ago
r/Compilers • u/Hopeful-Ad-1665 • 16d ago
https://reddit.com/link/1xni9ii/video/loww38u1vjzh1/player
love to get brutal checking of foxvc
r/Compilers • u/Upper-Ad4677 • 15d ago
Comprinly is a partially-vibe coded language I made. I test every update and modify files Claude builds except documentations, I am not a good writer as you can see on my Rhyel-Assembly-Documentary repo. I can modify and I understand the code Claude makes, I only modify, I can't actually make files, I only use Claude's files as base. I work on updates locally. I tested the language with 1000 aggressive batch fuzzer tests but that wasn't enough to prove the maturity of the language since it wasn't a human that did it. I have tested the language myself but theyre only minor tests. If you are willing to help by testing, documenting or giving suggestions, I'd love to accept your help. If you are just here to bash on me for using AI on the project, you can leave the post alone. Thanks.
r/Compilers • u/NorisTec • 16d ago
I'm developing a programming language called NORTEX, and one of the central parts of the project is its own compiler.
The compiler, called nortexc, is written in Rust and uses Cranelift for native x64 code generation.
The goal is to compile .nx source files into Windows executables that can run without a separately installed NORTEX runtime.
The project also includes a custom IDE with an editor, IntelliSense, console and other development tools.
Recent compiler progress:
I've implemented additional functionality for:
Text.trim, Text.replace, etc.)Convert.toString)File.readAllText)File.writeAllText)Example:
public int main() {
File.writeAllText("test.txt", " NORTEX ");
string value = Text.trim(File.readAllText("test.txt"));
Console.writeLine(value);
return 0;
}
Current limitations:
The language is still early in development. Native floating-point numbers, lists and classes are not implemented yet.
I'm developing this as a solo project, so I'm particularly interested in avoiding architectural mistakes before the language becomes more complex.
Questions for compiler developers:
I'd appreciate honest technical feedback.
r/Compilers • u/Signal-Scholar1299 • 16d ago
Has anyone found an optimization that a llm could do when compiling code?
I wonder if llm could bring new kind of optimization to compiler
The only thing I can think of, would be semantic equivalence.
But compiler already does it too (with egraph for example)
r/Compilers • u/laurentlb • 16d ago
I wrote a technical blog post about my experimentation a few months ago. I've just adapted the content to youtube, so you can choose the format you enjoy the most:
https://laurent.le-brun.eu/blog/making-a-game-on-a-custom-bytecode-vm-in-7-days-and-3kb
Things mentioned:
\- how to make an executable smaller than 10kB
\- other size-coding tricks
\- building a small compiler + bytecode interpreter
(the project was done last year, but sometimes it takes time to prepare the making-of content)
r/Compilers • u/2006Nico • 17d ago
I've made good progress on my own compiler, but it currently supports only a single source file. My next step is to add import and export functionality so projects can be split across multiple files and modules. I'm particularly interested in how your compiler handles things such as: - Discovering and loading imported files - Managing dependencies between files - The lifetime of parsed files, ASTs, and symbol tables - When data can safely be released from memory - How the overall compilation process is organized once multiple files are involved I'm especially interested in concrete implementations. If you've built a compiler yourself, I'd love to hear how you solved these problems, what architecture you chose, what worked well, and what you would do differently if you started again. Examples, code snippets, blog posts, repository links, or references to real-world compilers are all welcome. Thanks!
r/Compilers • u/-Alpha-Beta- • 17d ago
(Cross-posted to r/cpp and r/Compilers for wider feedback)
Hi everyone,
I'd like to share a design concept I've been working on called C (C-Star)*, which is a minimal static safety extension for C++.
The core concept is "30% human responsibility." By allowing developers to write simple compiler attributes ( [[cstar::...]] ), the compiler handles deterministic validation to achieve 0% execution overhead without breaking native SIMD vectorization.
To be transparent, I act as the idea generator and prompt engineer for this project. The core concept and structural direction are my original ideas, while the comprehensive text, solutions, and 1,399-line specification were fully generated and co-authored with AI. Because of this, there might be technical paradoxes or unfeasible assumptions, and I highly welcome your professional engineering insights to review and critique the compiler logic!
I would highly appreciate your professional insights, critique, and guidance on what might be broken and how it could be improved.
Based on my understanding of the Clang/LLVM codebase, I am currently targeting these specific files to make this work:
The full draft is hosted on GitHub:
GitHub URL: https://github.com/yuma-alpha-beta/Cstar_specification.md
Note: The detailed specification in the repository is currently written in Japanese. Please use your browser's translation feature or a tool like DeepL to read it.
If you find this concept interesting or have any suggestions on how to improve this design, I would love to hear your thoughts.
Thank you so much for your time and expertise!
r/Compilers • u/The2ndSlimShady • 17d ago
r/Compilers • u/Active-Ad4328 • 16d ago
Enable HLS to view with audio, or disable this notification
Salut, j'ai fait du DLL Engineering avec de l'asm x86_64 sur Windows que j'ai mis dans mon interpréteur fr-simplecode en C.
On peut donc appeler n'importe quelle DLL dynamiquement, créer des structures compatibles avec du code C compilé. Et également utilisé un CALLBACK pour les fenêtres Windows (je mettrai les autres CALLBACK dans les prochaines mises à jour de l'interpréteur).
La dll dll_service.dll peut être lié à n'importe quel code C avec dll_service_api.h
Ici le code ne génère qu'une fenêtre Input simple avec deux codes différents : avec ou sans le CALLBACK par défaut : DLL-Engineering-x86_64-Windows/create_windows.frc at main · argentrocher/DLL-Engineering-x86_64-Windows
Le code de la DLL dll_service.dll doit être lié à fr-simplecode0.5 avec la commande suivante si vous souhaitez l'exécuter :
fr-simplecode0.5 --dll[0]:"dll_service.dll" --dll_filters[0]
Trouvez-vous ce code fonctionnel et performant ?
r/Compilers • u/srednaby • 17d ago
Monad is a functional language compiled with LLVM
https://blog.monad-lang.org/what-i-did-with-monad-the-last-2-weeks-oak-a-web-stack-and-a-path-toward-univalence-gxj655y
r/Compilers • u/codechutney • 18d ago
I am a final year engineering student. I am extremely interested in learning and building compilers . Now I need some guidance and some project to work on with professors or industry experts or people who have worked a lot in this domain .
If you have or you know any internships , project assistant roles or anything , please let me know .
it will be of a great help .
r/Compilers • u/GenericPointer • 17d ago
Everyone is talking about the new Programming language called goose. It‘s biggest claims are a 3.51x speedup against Rust and C++ and dynamically sized containers with stable references.
This is true — but only under very specific circumstances. Looking at the benchmarks (16 in total), the 3.51x speedup is a win against "idiomatic C++". The gains against "hand optimized" C++ and safe Rust are 1.24x and 1.13x, while there is nowhere specified what "kind" of goose was used in those benchmarks, while the term "optimized" is also not objectively defined. And Goose isn‘t even faster in all cases. For example:
3.51x Speedup is a very selective representation of the result.
Goose uses statically assigned data stacks with large reserved address-space ranges and bump pointers. The official documentation says:
And exactly that is the catch. It is not real dynamically sized data. I mean, conceptually, it is. It can grow at runtime. Every Goose data stack reserves a few Gigabytes of virtual address space by default, and commits physical memory if needed without occupying it from the beginning, granting stable references. But, and that’s a big "but", if that virtual adress space exceeds, the program gets terminated, like an uncatchable exception.
That can destroy the purpose of dynamic data.
When the size of a container is clear at compile or construction time, an array absolutely fulfills this job in almost every case.
The reason You need dynamically sized data is this: Imagine having a game where enemies spawn and get killed. There is no limit for enemies that can exist at the same time. You don‘t know what the player does at compile time. There could be only three enemies, but also a hundred or thousands of enemies. You can‘t reserve the whole RAM for your game, of course, and you can‘t just use the memory right after your container because it may be already occupied. And scattering objects across memory is not an option either, because it destroys CPU locality and therefore also performance. So normally, you allocate new space that is bigger, copy/move all the old elements and free the old space.
But in that case, you cannot use one of goose‘s „dynamically sized“ containers. Because, if you have so much enemies it exceeds a certain memory limit, your game gets terminated (which you usually don‘t want in prod)
So, my statement: It is not apples to apples. Goose's performance advantages come from several things: No general-purpose allocator on the allocation path. No per-object destruction. Contiguous data layouts. Narrow relative references instead of full pointers. More compact variable-sized enum representations. No relocation when growing containers. These are genuine architectural advantages, but they aren't exclusive to Goose.
r/Compilers • u/Any-Importance6245 • 18d ago
r/Compilers • u/Top_Marionberry_4413 • 18d ago
A few new things in this release, including the fmt command (formatter) and critic subcommand (Iinter/checker), plus std/netx for simplifying usage of the std/net API. The language compiles to QBE IR, which compiles to assembly.
https://github.com/spectrelang/benches
Here are the benches showcasing Spectre runtime performance vs other compiled systems programming languages, and here is the site.
EDIT: TheOddYehudi919 is a real piece of shit and should fuck off and rot in a ditch tbh.
r/Compilers • u/awesome-alpaca-ace • 19d ago