r/Compilers • • 25d ago

Finally got dependencies and cycles fully automatically resolved in BRC

Thumbnail github.com
3 Upvotes

One of my main goals for BRC was to get rid of headers and for the compiler to automatically resolve the inter-dependencies. I like coding in C and C++, but having code split into header and implementation has always irked me. I've implemented DFS topological search on statements and imports to determine the correct order. Not only it works like a charm, but it made the code actually shorter and faster.

I'm using the language to build an OS Bits Runner. The project already has a lot of .brc source files, so being able to automate this part makes is so much easier.


r/Compilers • • 24d ago

transpilation - Bootstrap compiler

Thumbnail reddit.com
1 Upvotes

r/Compilers • • 25d ago

Finally added support for strings, imports and externs after a year of procastination

8 Upvotes

Hi guys!
So I have been working on this small language on and off over the past two years lol
and today I finally added in support for importing external c functions and strings :p along with other stuffs like upgrading the codebase from llvm 14 to llvm 23.

There are still a lot of stuff that I want to add including support for structs and arrys(which already kinda exists but is partial)

I am hoping to make the language as kind of a "simplistic systems programming language" for the "joy of programming" essentially a language that actually makes making things fun :D if that makes sense lmao

Link: https://github.com/Lioncat2002/HelixLang


r/Compilers • • 25d ago

Currently what are some prominent research gaps in Compiler Optimization or Correctness?

23 Upvotes

I am a PhD student starting to get into the compiler domain but I have minimal knowledge in the area. I have been looking specifically into MLIR optimization and correctness in the lowering phase but every broad topic I look into seems to be extensively researched months or even years ago. I just feel very lost and can't seem to find where to start. Not asking for anyone to hand me a fully composed topic. I just hope I could get some guidance and resources to help me get started with anything concrete.


r/Compilers • • 25d ago

potentially using the interpreter diversity of Python against attacks?

6 Upvotes

To detect, if a compiler is compromised, one takes multiple independent compilers to compile the compiler. Now you have multiple compilers - use them to compile a programm and check if the binaries match - if they don't, at least one compiler used to compile the compiler, that compiled the programm is either compromised or faulty. (that's a lot of compiler xD)

That is the standard approach.

But instead of that, why not just write one compiler in python, that can then compile your compiler? Like, there are so many different Python interpreters that you can use to check if your compiler is compromised. This makes a malicious attack from the used python compiler basically impossible, because it's unreasonable to assume that every python interpreter is compromised at once. Also, it would give nieche languages a way to check if their compiler is compromised.

Sadly, this also introduces the weakness of one point of failure. If the compiler written in Python is faulty, it can't be detected. Additionally, interpreters are REALLY slow. So - does the idea have merit, or should one just use the C compiler from that open source bootstrap chain and write their own compiler in C?


r/Compilers • • 25d ago

yr: DSL to reduce boilerplate

5 Upvotes

Hello, everyone.

In 2021 I had a household accident and broke my humerus, and the recovery took a long time. I had a few clients, and they kept coming from the same niche, so I ended up with a lot of boilerplate. Since I'm full-stack, that meant code in bash, HTML, JS, and so on.

To cut down on rewriting or copy-pasting the same code (this was well before AI), I decided to build yr. I've been using it ever since, in its official IDE, Yrkit (a work in progress, but already in production).

It works like this: I write code in sections marked by specific symbols, e.g. ## for CSS and @@ for frontend JS. At the end, my parser generates all the artifacts, either as JSON or by writing straight to disk.

A Hello World in yr looks like this:

>>

_title

Hello World

><

_ .hw-container

.hw-container {

background: red;

color: white;

}

@@

document.querySelector('.hw-container').textContent = 'Hello world!';

That's just for illustration. There's a lot more, like macros, devops (actions), backend, React, etc. I'm putting together public repos to show the language in use with real, complete systems.

If you can take a look at the docs, I'd appreciate it:

yr-lang: https://yr-lang.org (goals, motivation, and how to use it, though I'll admit I've implemented a few things that aren't documented yet)

IDE (you can start writing right away): https://yrkit.site

Small editor in my portfolio: https://mwtheus.github.io

I built this to solve specific needs I had, but I'm happy to share the idea with the world. Maybe someone else would like to code this way too.


r/Compilers • • 25d ago

Currently what are some prominent research gaps in Compiler Optimization or Correctness?

Thumbnail reddit.com
4 Upvotes

r/Compilers • • 25d ago

Rethinking Abstractions in the Agentic Era: Towards a DSL and Compiler Foundation for Agentic Kernel Development

Thumbnail tvm.apache.org
0 Upvotes

r/Compilers • • 26d ago

Simple True Interpreter

4 Upvotes

r/Compilers • • 26d 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 • • 25d 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 • • 27d ago

Visualized grammar analyzer

Thumbnail gallery
14 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 • • 26d 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 • • 27d ago

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

Thumbnail blog.tauto.run
10 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 • • 27d 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 • • 27d ago

XLA from the Trenches: Correctness on TPU Workloads at Scale

Thumbnail arxiv.org
3 Upvotes

r/Compilers • • 27d 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

love to get brutal checking of foxvc


r/Compilers • • 26d 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 • • 27d 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 • • 27d 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 • • 27d 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 • • 28d 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 • • 27d 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 • • 28d ago

Major Updates to Cole Compile-Time Execution and Type Reflection

Thumbnail reddit.com
1 Upvotes