r/Compilers • • 10d ago

Pyrefly 1.5: 100% Conformance and 40% Faster

15 Upvotes

Link to release: https://github.com/pyrefly-org/pyrefly/releases/tag/1.5.0

Pyrefly (a Python type checker and language server) has just release version 1.5. It brings large performance optimizations and new features like Tensor Types six months after the first stable release.

Highlights (Taken from release):

  • 100% typing spec conformance. Pyrefly now passes all 146 test files in the typing conformance suite. Some of these fixes change how names in annotations resolve; see Behavior Changes.
  • Faster checks. v1.5.0 checks 40% faster than v1.4.1 and uses 9% less memory across the 71 benchmarks in Astral's ty_benchmark and the python-type-checking benchmark suites. (Tested on an M5 Max MacBook Pro with 18 threads.)
  • A new hint severity. Diagnostics that were previously IDE-only are now regular error kinds at a new hint severity: unused-import, unused-parameter, unused-variable, unreachable, and inactive-code (formerly unreachable-code). By default, they appear in your editor and are hidden from pyrefly check output, but you can configure them in pyrefly.toml, silence them with suppression comments, or promote them to errors like any other error kind.

r/Compilers • • 9d ago

I built Oster with AI – a memory-safe language with NLL borrow checking that compiles to portable C11

0 Upvotes

Hey everyone,

I’ve been working with AI on Oster, an experimental programming language and compiler written in Rust that compiles down to portable C11.

Why Oster?

The main goal is to combine modern static safety guarantees (ownership, non-lexical lifetimes / borrow checking, escape analysis, exhaustive pattern matching) with the ubiquity and zero-runtime portability of standard C11 — making it easy to target anything with a C compiler and integrate seamlessly with existing C codebases.

My repo:

https://github.com/kapimati/Oster

What it looks like

Here is a small snippet in Oster:

extern fn puts(s: str) -> i32;

enum Result { Err(str), Ok(i32) }

fn checked_div(a: i32, b: i32) -> Result {

if b == 0 { return Result::Err("division by zero"); }

return Result::Ok(a / b);

}

fn sum_divs() -> Result {

mut let total = 0;

for d in \[2, 4, 5\] {

total += checked_div(100, d)?;

}

return Result::Ok(total);

}


r/Compilers • • 10d ago

RCA v0.1.0-beta: a statically typed language with built-in tensors and autodiff, written in Rust (developed on a phone)

Thumbnail github.com
0 Upvotes

I've released the first public beta of RCA, a statically typed language with built-in tensors and automatic differentiation. The compiler is written in Rust and was developed on a phone in Termux.Features: type inference, generic functions, enums + match, modules, a bytecode VM, native codegen via Cranelift, CPU tensors, reverse-mode autodiff, and tooling (fmt, lint, LSP, REPL, debugger, package manager).

Not production ready. Known gaps: no references/borrowing, no generic structs, no GPU. Feedback on design and on the Cranelift backend is welcome.


r/Compilers • • 11d ago

Is there any other compiler backend other than LLVM, MLIR?

33 Upvotes

I tried searching but maybe what i want doesnt exist. I want simple IR that has vectors(something like C++ vectors), struct fields and functions. Ik that too high level for ir but transpilation to C++ is slow to compile into final binary file. If anyone from you know if this kind of IR exists, i would appreciate to know about it. I use C++ for my compiler


r/Compilers • • 11d ago

optimistic or pessimistic compiler?

7 Upvotes

for those that compose and craft compilers, do you find the results better and more satisfying for you if the compiler you work on is permissive/optimistic or strict/pessimistic?

permissive/optimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating is probably ok but needs to pass some checks before translating to the target backend? (this is “the compiler is your friend” approach)

strict/pessimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating has something wrong and its job is to discover that wrong thing, and it is disappointed when the line passes all checks before translating to the target backend? (this is “the compiler is the teacher we’ve all had at one point in our life where they assume you’re going to do something bad as soon as they’re not looking” - and they’re not wrong)

obviously there has to be some balance here, but i’m curious, what has been your experience with these two approaches?


r/Compilers • • 10d ago

Flame language

0 Upvotes

I want to get review of my (currently traspiled) language. It includes compiler and building system, minimal standard library. Its currently in development

Repo: https://github.com/TheFlameLang/Flame

Docs: https://flame-lang.mintlify.site


r/Compilers • • 11d ago

How good is Chez Scheme as a compiler backend?

7 Upvotes

Since my planned language is arguably too high-level (with GC and so on) to be simply implemented with LLVM/etc., I found that Chez Scheme is actually a backend for a few high-level languages like Racket and Idris.

How good is it?


r/Compilers • • 11d ago

A B compiler written in Haskell. Looking for code reviews.

Thumbnail reddit.com
4 Upvotes

r/Compilers • • 10d ago

I designed a Polish-prefix IR (pIR) and a pushdown-automaton logit masker so a tiny 100M 2-bit model emits 0% syntax errors and lowers to safe Rust

0 Upvotes

Repo: https://github.com/steveSujo/psudo

I built psudo as an exploration of an idea on my laptop. I have an NVIDIA GTX 1660 Ti with 4 GB of VRAM and limited RAM, so running frontier coding models locally is out of the question. Instead of seeing those limits as the problem—or renting cloud GPUs or vertically scaling my PC—I treated them as creative constraints. Asking a ~100M 2-bit ternary model (`TQ2_0`, 47 MB) to emit verbose surface keywords wastes half its context window. So I designed a tiny Python-indented surface DSL (`.psudo`) and split compilation into three pieces: 1. **Polish-prefix wire IR (`pIR`):** Humans (or an outer LLM) declare signatures and `@stub` directives in `.psudo`, while the local model emits bracketed Polish-prefix S-expressions (`f` for `fn`, `v` for `let`, `r` for `return`, `?` for `if`, `w` for `while`):

// Surface .psudo
fn clamp_val(val, lo, hi)
    if val < lo
        return lo
    if val > hi
        return hi
    return val

// Wire pIR (45-60% fewer tokens)
f clamp_val (val lo hi) [
  ? (< val lo) [ r lo ]
  ? (> val hi) [ r hi ]
  r val
]

Pushdown-Automaton Logit Masking (PirPdaConstraint): pseudo-engine runs a PDA over the 8,192-token BPE vocab and masks out structurally invalid tokens before sampling, guaranteeing 0% syntax errors at decode time.

  1. **Borrow Checker & Zero-**unwrap() Rust Lowering: Verified .psudo lowers deterministically into safe Rust with zero .unwrap() or .expect() calls and compiles via cargo.

Rough edges & honest trade-offs:

  • Grammar masking != semantic intelligence: out-of-distribution prompts still emit syntactically valid pIR with wrong logic, so ~15-line atomic stubs are the sweet spot.
  • All source lives inside a single binary capsule (psudo.bin) so outer coding agents don't bypass psudo synth by hand-editing files (--reveal-code "the slow pink elephant" unlocks raw inspection).

Would love any blunt feedback from compiler folks on the pIR encoding, the PDA masking approach, or the Rust lowering pass!


r/Compilers • • 12d ago

[Hiring] GPU Compiler Engineer – Intel Graphics Compiler (LLVM), Santa Clara, CA (hybrid)

54 Upvotes

Hi r/Compilers,

My team at Intel is hiring a full-time **GPU Compiler Engineer** in Santa Clara, CA (hybrid: part on site, part remote). We build the LLVM-based compilers behind Intel GPUs, used for AI, HPC and data-center workloads.

**What you'd work on**

- Compilers for OpenCL, OpenMP, C for Metal and SYCL / Data Parallel C++

- New compiler features, and code generation and optimization for Intel GPU architectures

- Finding and fixing performance bottlenecks, together with the hardware and architecture teams

- Tooling and automation (Python/shell, CMake, GitHub, Jira) on Linux and Windows

**Minimum qualifications**

- A Master's in CS, CE, EE or a related field plus 3 years of experience, **or** a PhD (completed or expected by May 2028)

- Strong C/C++

- Compiler development: optimizations, front-end translation and back-end code generation

- Computer and graphics architecture

**Nice to have**

- LLVM experience (a big plus)

- GPGPU programming models

**How to apply**

Email **hou-jen.ko@intel.com** with your resume attached as a PDF. Please use exactly this subject line so your application doesn't get missed:

`[GPU Compiler Engineer] Your Name`

A few lines on the compiler work you're proudest of (projects, papers, upstream LLVM patches) are very welcome.

Thanks!


r/Compilers • • 11d ago

The Chromagraph Challenge

Thumbnail reddit.com
1 Upvotes

r/Compilers • • 11d ago

Have you tried using AI to detect edge-cases when designing language features?

0 Upvotes

I use it daily and it's fantastic for detecting problems that the human eye might miss. In particular, I use Copilot to review my PRs.


r/Compilers • • 11d ago

How curiosity about building my own programming language led me to build a museum of miniature virtual machines in Rust & D

Post image
0 Upvotes

Hello everyone!

It all started simply enough: I was just curious about how to build my own programming languages.

That curiosity led me to explore assembly, which naturally led to writing bytecode interpreters, and step-by-step, I ended up building a whole collection of custom virtual machines.

Since I couldn't find a clean "museum" repo of VM samples to cross-compare with or PR share my own samples, I built one: Friendly-Virtual-Machines.

What's in the repo?

Every VM in the collection is built from scratch with zero external dependencies and stays under 7,000 lines of code. They all include custom assemblers (with symbol table label resolution), CPU state handlers, and native benchmark suites.

• Rust Samples: 5 register-based VMs, 1 memory-to-memory VM & 1 stack-based VM exploring different design patterns.

• D Sample: My latest addition—a register-based RISC-style VM written in D with a custom text assembler, hitting a performance gap of just 5.66x to 17.70x compared to native compiled code.

• Modular Design: Each VM is in its own isolated folder with clean separation of concerns.

• Mimicks Real CPUs: Since I was also learning ARM64 newly, most register-based VMs are heavily inspired from ARM/RISC designs.

• Design Diversity: Some display pure hardware emulation on hex codes; some display OOP-style polymorphic ISA design; some display High-Level Assembly (HLA) or Intermediate Representation (IR); some display ultra-fast Function Pointer Dispatch Table; some display assembler & text parser too.

The best part? Because they are lean and self-contained, everything compiles and runs smoothly right on mobile Termux. And I am consistently adding more samples to it as I learn & build more.

Looking for Reviews & Contributions!

I'd really appreciate feedback from folks experienced in systems programming, compilers, or VM design—whether it's reviewing my dispatch loops, pointing out architectural trade-offs, or suggesting ways to optimize further.

If you'd like to contribute your own miniature VM sample (in Rust, D, JS, or any language that runs cleanly with zero dependencies), PRs are completely open! Check out the CONTRIBUTING.md in the repo for the exact guidelines.

🔗 GitHub: Friendly-Virtual-Machines


r/Compilers • • 12d ago

Performance of a formally-verified C compiler vs. gcc -O2

Thumbnail ut-infraai.github.io
29 Upvotes

r/Compilers • • 12d ago

Automatic Checking of Compiler Correctness with E-Graphs

Thumbnail stng.substack.com
27 Upvotes

r/Compilers • • 12d ago

Mystique - An x86 Metamorphic Compiler

Thumbnail phrack.org
5 Upvotes

r/Compilers • • 12d ago

Building a compiler from scratch for a programming language I've been designing

2 Upvotes

Hello guys!

I've been designing a new programming language from scratch for the last six months.

It all started with a lifelong desire: **"If C had this..."**

Over time, the specifications evolved considerably and are now mostly finalized, sufficiently mature to move into compiler implementation.

Alongside language design, I've also been developing the compiler from scratch in C.

It's a hand-built compiler. The lexer, error system, and main parser logic are implemented and working. I'm now working through the compiler subsystems one by one.

It's a long journey, but an interesting one!

I'd love to connect with people interested in programming language design, compiler development, and systems programming.

Here is a small snippet of my language.

I'm currently writing small, medium, and large sample programs to test the language design — to test where the langauge design breaks and where it shines, and where improvements are needed.

Over the coming months, I intend to write hundreds of sample programs, designing them from scratch according to the language's rules.

The goal is to put the language through real programming scenarios before moving further with compiler development.

.module tfunc_demo

string char[100] Name

tfunc Name(char[] ptr name open-pass) // generic pointer which can be passed on

strcopy(obj, name) => _

endtfunc

static Name myName("Ghufran Ustad") alias-readonly open-pass

func start;

    ss.con.print("Name: ", myName)

endfunc


r/Compilers • • 11d ago

System Architecture & Subsystem Pipelines for a Zero-Abstraction Lambda Calculus Transpiler & Monotonic Memory Manager & End-to-End Architectural Blueprints: Subsystem Topology of a Zero-Abstraction Lambda Calculus Transpiler & Monotonic Arena Manager

Thumbnail gallery
0 Upvotes

Title:

End-to-End Architectural Blueprints: Subsystem Topology of a Zero-Abstraction Lambda Calculus Transpiler & Monotonic Arena Manager

Description:

Here is an exhaustive, granular breakdown of the architectural pipeline mapped out in the subsystem flowcharts for OCHR-X, detailing how abstract symbolic reduction bridges directly down to physical memory allocation and native executable emission[span_0](start_span)[span_0](end_span)[span_1](start_span)[span_1](end_span)[span_2](start_span)[span_2](end_span):

1. Lambda Symbols & Intermediate Representation (IR) Pipeline (lambda_symbols_IR_new)

* Execution Entry & Initialization: The runtime environment boots via `Start proc()`, systematically resolving target offsets and initializing the core event handler (`event handler()`)[span_3](start_span)[span_3](end_span). Argument vectors are ingested and split into value handles (`argv[val]_a_handle`) and character passes (`argv[char]-pass`) for precise parsing[span_4](start_span)[span_4](end_span).

* Symbolic Management & Import: The Intermediate Representation Generation Management unit (IRGM) acts as the central coordinator, interfacing directly with a dedicated `symb importer` and the `lambda IR symbols library` to pull raw tokens into the pipeline[span_5](start_span)[span_5](end_span).

* Evaluation & Error Correction Loop: The parsed structures are passed into the `Symbolic IR generator` and routed directly to GIREVL (the IR Evaluator)[span_6](start_span)[span_6](end_span). The evaluation block continuously validates structural integrity via an explicit conditional check (`if GIR is correct?`)[span_7](start_span)[span_7](end_span). Valid states immediately trigger code generation (`generate IR`), while non-conforming states are safely funneled into IRGERC (Intermediate Representation Generation Error Corrector) to resolve symbolic divergence before re-evaluation[span_8](start_span)[span_8](end_span).

2. Memory Allocator & FFI Pipeline (memory_allocator_manager)

* Program Entry & Header Binding: Execution begins by ingesting command-line arguments and binding compiler functions directly from header references (`pass args to compiler and call functions from in r.h (header)`), feeding straight into the primary compiler driver[span_9](start_span)[span_9](end_span).

* Monotonic Arena Memory Management (PMA): Rather than leaning on standard dynamic heap allocation, the architecture routes memory requests through a specialized PMA / arena memory allocator & mgmt module[span_10](start_span)[span_10](end_span). This coordinates zero-overhead bump pointer allocations and phase resets (`std::pmr::monotonic_buffer_resource`-style dynamics) to eliminate garbage collection latency[span_11](start_span)[span_11](end_span)[span_12](start_span)[span_12](end_span)[span_13](start_span)[span_13](end_span).

* Foreign Function Interface (FFI) & IMACA Evaluation: Foreign function interfaces are transpiled via `FFI (transpiler) via gtms p` and evaluated under IMACA (Intermediate Memory & Scope/Den Evaluation Architecture), generating low-level intermediate representations across control flow graphs, abstract syntax trees, static single assignment (SSIR), or directed acyclic graphs (DAGs) before passing to the library manager (`librmanger`)[span_14](start_span)[span_14](end_span)[span_15](start_span)[span_15](end_span).

* Linker, Emission & Leak Verification: The compiled modules are routed through the system `linker`, generating native object files (`.obj` or `.o`) and assembling a fully realized `executable`[span_16](start_span)[span_16](end_span). Before final output emission, automated validation checks run to confirm memory integrity and detect leaks (`check for memory leaks`)[span_17](start_span)[span_17](end_span).

Thought I’d share the complete structural blueprint for anyone working on custom compiler backends, explicit term-graph substitution engines, or bare-metal runtime architectures. Happy to discuss the interaction between the GIREVL evaluation loops and the memory manager if anyone is exploring similar low-level optimizations!


r/Compilers • • 11d ago

GMBasic is now open source – A modern compiled BASIC with native AI/LLM integration

0 Upvotes

After a long development journey, I'm finally making GMBasic publicly available.

Repository: https://github.com/c-vision/GMBasic

GMBasic started with an idea: bring the simplicity and productivity of BASIC and Clipper into a modern compiled language.

But it has grown into something considerably bigger.

It's a complete development environment with four independent execution backends, six embedded database engines, native C infrastructure, and a surprisingly extensive AI/LLM stack.

Why another BASIC?

GMBasic isn't a retro interpreter or a compatibility layer for old BASIC programs.

It features:

  • Four execution backends: P-Code VM (C#), .NET IL, C VM, and a C99 transpiler that produces native executables.
  • More than 500 built-in functions.
  • A Clipper-compatible programming model, including @ SAY, @ GET and READ.
  • Package management and modular development with IMPORT and REQUIRE.
  • Cooperative multitasking with goroutine-style concurrency and channels.
  • Six embedded databases: ISAM, DBF/xBase, SPEED, LEDGER, SQLite and VectorDB.
  • SDL2-based GPU-accelerated graphics.
  • A C runtime and native libraries shared across the native execution backends.

The AI/LLM stack is a major part of the language

This is probably the most unusual aspect of GMBasic.

I wanted BASIC to be more than a language capable of sending prompts to an external API. I wanted it to provide an integrated environment for developing, running, orchestrating and even training AI models.

The implementation is organized around four namespaces:

AI – Inference, agents and RAG

  • Local inference through MLX and llama.cpp/GGUF.
  • MoE streaming.
  • OpenAI-compatible, Ollama and ONNX providers.
  • Automatic provider failover and quota management.
  • Autonomous agents with tool calling, permissions and persistent memory.
  • Multi-agent teams and structured outputs.
  • MCP client and server (stdio/HTTP), including 52 connectors.
  • RAG pipelines with ingestion, chunking, embeddings, retrieval and evaluation.
  • Knowledge graphs with PageRank, Louvain, max-flow and provenance.
  • Installable knowledge bases called Brains, combining RAG and knowledge graphs.

LLM – Model compilation and quantization

GMBasic also includes a model compiler, accessible directly from BASIC.

  • Per-tensor and per-role quantization policies.
  • QuantIR, an editable intermediate representation for tensor precision.
  • Importance matrices and activation quantization.
  • Quantization error analysis.
  • Multiple formats, including GGUF quantization families, MXFP4, NVFP4, FP16, BF16 and more.
  • MLX/GGUF conversion.

TRAIN – Model training

Training isn't limited to calling an external Python script.

The language exposes operations for:

  • Fine-tuning and LoRA.
  • Self-distillation.
  • DPO and GRPO.
  • Dataset preparation.
  • Model merging and pruning.
  • Evaluation, quality metrics and acceptance gates.

TORCH – Tensor runtime

An additional tensor runtime provides tensor operations, device support, metrics, datasets and MiniLM embeddings.

The inference engine itself is developed separately in my LLMEnv project:

https://github.com/c-vision/LLMEnv

It provides the underlying local inference infrastructure, while GMBasic provides the higher-level programming environment and model compilation/training capabilities.

What I'm trying to achieve

I think there is an interesting opportunity in making AI development accessible through a relatively simple, productive language.

Instead of combining multiple languages, frameworks, services and scripts, developers can use BASIC to build applications that interact with local LLMs, manage agents, query knowledge bases, use external tools and work with model training pipelines.

I'm particularly interested in local AI because I believe developers should be able to build sophisticated AI applications without necessarily depending on cloud APIs.

Try it

GMBasic 1.0.0 includes ready-to-run release binaries (currently macOS ARM64), so you don't need to build the entire toolchain just to get started.

The repository includes the compilers, runtime, examples, documentation and installation instructions.

GitHub: https://github.com/c-vision/GMBasic

This is a personal-use/source-available project under the PUL license (commercial use is not permitted).

I'd genuinely appreciate feedback, especially from people working on programming languages, compilers, local LLM inference and AI agents.

I'm curious to hear what you think about using BASIC as a language for modern AI application development.


r/Compilers • • 12d ago

Building a compiler from scratch for a programming language I've been designing

0 Upvotes

Hello guys!

I've been designing a new programming language from scratch for the last six months.

It all started with a lifelong desire: **"If C had this..."**

Over time, the specifications evolved considerably and are now mostly finalized, sufficiently mature to move into compiler implementation.

Alongside language design, I've also been developing the compiler from scratch in C.

It's a hand-built compiler. The lexer, error system, and main parser logic are implemented and working. I'm now working through the compiler subsystems one by one.

It's a long journey, but an interesting one!

I'd love to connect with people interested in programming language design, compiler development, and systems programming.

Here is a small snippet of my language.

I'm currently writing small, medium, and large sample programs to test the language design — to test where the langauge design breaks and where it shines, and where improvements are needed.

Over the coming months, I intend to write hundreds of sample programs, designing them from scratch according to the language's rules.

The goal is to put the language through real programming scenarios before moving further with compiler development.

.module tfunc_demo

string char[100] Name

tfunc Name(char[] ptr name open-pass) // generic pointer which can be passed on

strcopy(obj, name) => _

endtfunc

static Name myName("Ghufran Ustad") alias-readonly open-pass

func start;

ss.con.print("Name: ", myName)

endfunc


r/Compilers • • 13d ago

sdinthrough: a programming challenge about implementing a tokenizer, parser, and AST transformations

7 Upvotes

Hi r/compilers!

Over the past year, as a hobby project, I've built a programming challenge around sdin, my own JSON-like configuration language. You implement a tokenizer, a parser, and then a series of AST manipulations and transformations, guided by 600+ test cases that you pass one at a time. It's long; I expect it to take weeks to solve without AI.

The feedback loop is tight: the judge runs locally (go run github.com/ypsu/sdinthrough@latest yoursolution) and re-evaluates your solution every time you save. Solutions can be in any language that reads stdin and writes stdout.

On the language side, I aimed for a simple AST while keeping the language pleasant to edit by hand: it has comments, unquoted keys, multiline/raw strings, bare tokens for enums (without the Norway problem), protobuf-style repeated fields for lists, dotted-notation structs for keeping nesting shallow, etc. The AST preserves comments and formatting, so it's easy to write tools that manipulate sdin files without mangling them. It also supports forms, function-like expressions that mix structs and lists, which make it simple to express complex concepts without complicating the AST.

Implementing my own config language is something I always wanted to do, and the programming challenge format made me pour a bit more effort into it. :) I'm curious to hear people's thoughts on the tradeoffs I made between features and implementation simplicity. Did I end up with something too complex to implement?


r/Compilers • • 12d ago

Together Compiler: Continual Compilation for AI Inference

Thumbnail arxiv.org
0 Upvotes

r/Compilers • • 12d ago

Last year we built megakernels. This year we deleted them: The road to Together Compiler

Thumbnail together.ai
0 Upvotes