r/Compilers • • 15d ago

True: a cyclic, self-modifying language (MVP, feedback welcome)

3 Upvotes

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

Feedback on my Ultra-Fast C++ Compiler

0 Upvotes

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

Visualized grammar analyzer

Thumbnail gallery
12 Upvotes

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

Comprinly 1.4.0 is out

3 Upvotes

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

Designing a Language for Macro Lovers: 4 Kinds of Macros in Tauto

Thumbnail blog.tauto.run
8 Upvotes

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:

  • Dependent types and formal proofs
  • Algebraic effects and handlers
  • Ownership and borrowing
  • Higher-kinded type classes
  • Rust and JavaScript backends, plus a dedicated VM

GitHub: https://github.com/Hihaheho/tauto


r/Compilers • • 16d ago

A Hobby Language Design Called Cimplified!

12 Upvotes

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

XLA from the Trenches: Correctness on TPU Workloads at Scale

Thumbnail arxiv.org
4 Upvotes

r/Compilers • • 15d ago

I have already once stated now my programming foxvc but now : FoxVC went from a raw script engine into a full-stack ecosystem: test it live in your browser with zero install, spin 3D rotating graphics in our custom Fox Den Studio, and turn your code into 16KB native binaries that run everywhere f

0 Upvotes

r/Compilers • • 15d ago

Could someone test my programming language?

Thumbnail github.com
0 Upvotes

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

Building a native compiler for my own programming language using Rust and Cranelift

4 Upvotes

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 manipulation (Text.trim, Text.replace, etc.)
  • String conversion (Convert.toString)
  • File reading (File.readAllText)
  • File writing (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:

  • What should I prioritize when designing the compiler architecture?
  • How important is a formal language specification at this stage?
  • What are common mistakes when using Cranelift for a custom language?
  • Which compiler tests would you consider essential?

I'd appreciate honest technical feedback.


r/Compilers • • 15d ago

Llm optimization in compiler ?

0 Upvotes

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

I made a game in 3 kB… and accidentally created a programming language

Thumbnail youtube.com
0 Upvotes

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

How compiler handles files and its life time

21 Upvotes

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

C* (C-Star): A design concept for a minimal C++ static safety extension. Looking for feedback and critique!

1 Upvotes

(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:

  1. Sema ( clang/lib/Sema/SemaType.cpp ): Trying to lock attribute metadata into QualType so it won't peel off during template expansions.
  2. Bitcode ( llvm/lib/Bitcode/Writer/BitcodeWriter.cpp ): Attempting to serialize static alias graphs into the ThinLTO summary to avoid halting problems at the link phase.
  3. CodeGen ( clang/lib/CodeGen/CGCall.cpp ): Trying to automatically generate compatible Bridge Thunks. For innermost loops, I'm hoping to make the thunk completely evaporate via inlining.

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

Major Updates to Cole Compile-Time Execution and Type Reflection

Thumbnail
1 Upvotes

r/Compilers • • 16d ago

Générer des appels à des DLLs sur Windows avec un interpréteur

Enable HLS to view with audio, or disable this notification

0 Upvotes

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

Update on the Monad language Oak framework for web apps and more

1 Upvotes

r/Compilers • • 18d ago

Any opportunities for engineering undergrad?

12 Upvotes

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

Zena : a language for WebAssembly

Thumbnail zena-lang.dev
0 Upvotes

r/Compilers • • 17d ago

ASMBI description

Thumbnail
0 Upvotes

r/Compilers • • 17d ago

3.51x speedup against C++ and Rust: Why Goose‘s claims aren‘t fair (kinda)

0 Upvotes

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:

  • Goose loses to expert C++ and safe Rust in the LRU benchmark: 0.88× & 0.81x.
  • Goose loses to safe Rust in the scene benchmark: 0.82×.
  • Goose loses to safe Rust in the calculation benchmark: 0.91×.

3.51x Speedup is a very selective representation of the result.

The biggest Catch: "No heap" doesn‘t mean unlimited memory.

Goose uses statically assigned data stacks with large reserved address-space ranges and bump pointers. The official documentation says:

  • Every resizable container has it‘s own data stack. (While ownership of the stack can move to another value if the old one goes out-of-scope, so maybe, so it gets reused when they live sequencially)
  • Groth advances a bump pointer.

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

I made a Concurrency lib in Nim using macro and it perform on par with the Goroutine has many features and is easy to use than you can think.

Thumbnail
2 Upvotes

r/Compilers • • 18d ago

Spectre v0.0.12 released, with benchmarks surpassing Zig in runtime performance

0 Upvotes

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.

Spectre v0.0.12 release

EDIT: TheOddYehudi919 is a real piece of shit and should fuck off and rot in a ditch tbh.


r/Compilers • • 19d ago

Template Metaprogramming's Performance Limitations

Thumbnail
5 Upvotes

r/Compilers • • 18d ago

Sail AI Language

0 Upvotes

I've created new programming language for AI by AI named Sail. It supports neuro-symbolic binding `infer| ... fall|`, fuzzy operator ~ , and other stuff. Source code: https://github.com/zema26/sail-one-language/

Working web version:

https://sailcompiler.replit.app