r/Compilers • u/santi34mg • 40m ago
Help with resources for learning
reddit.comIf anyone has a good resource I would appreciate it :)
r/Compilers • u/santi34mg • 40m ago
If anyone has a good resource I would appreciate it :)
r/Compilers • u/Advanced-Signal-9760 • 1h ago
r/Compilers • u/hxkhano • 9h ago
[Evie](https://hxkhan.github.io/evie/) is a small dynamic language I built to be embedded in Go programs. Its interpreter compiles the AST once into Go closures, so nothing inspects the tree at run time, and there's no bytecode or JIT.
On an 8-program benchmark suite (geometric mean) it comes out slightly ahead of C Lua 5.4 overall:
Evie 55.7 ms · Lua 5.4 57.5 ms · QuickJS 83.4 ms · Python 3 115.0 ms · V8 without JIT 120.7 ms
What makes it fast:
• Small values: every value is 16 bytes, with numbers stored inline and never allocated.
• Specialised operators: each operator gets a generated closure for every operand shape, such as local + constant or local + local, so the hot paths skip type dispatch.
• Dictionaries like CPython's: objects keep insertion order in a compact table, with one hash per lookup.
Lua still wins numeric loops and big dictionaries. Evie wins calls, classes and strings.
On AI use: I wrote the majority of the language myself; I've worked on state machines and VMs for 6 years. AI helped a lot but the majority is hand written by me: the user-facing error messages, the whole website, and the large parts that are mostly boilerplate rather than hard were mostly done by Claude and then verified by me.
I'd love feedback on all fronts.
Playground: https://hxkhan.github.io/evie/play/
r/Compilers • u/lmntr • 9h ago
r/Compilers • u/mikebmx1 • 15h ago
r/Compilers • u/naharashu • 1d ago
I read the kaleidoscope but it doesnt explain some things for my language that i need
r/Compilers • u/hardcoremaggiesimp • 1d ago
read the description for more info feel free to give feedback or contribute to it it has math native operators such as integration and summation also c native so can import any c library i believe
r/Compilers • u/G_oni_vv • 1d ago
Similarly, imagine a graphics application where only one object changes. The runtime could identify which data actually needs updating instead of recalculating everything unnecessarily.
My goal isn't simply to create another garbage collector or claim that this will automatically outperform existing languages.
I'm exploring whether a programming language can make resource management more intelligent while keeping it automatic for the programmer.
I'd like to hear your thoughts:
Would combining adaptive memory management, predictive execution, and incremental processing make sense as part of a language runtime?
Or would you prefer these responsibilities to remain separate systems?
I'm particularly interested in the architectural trade-offs and potential problems with this approach.
r/Compilers • u/Opening_Can_3656 • 1d ago
Hey everyone,
I’ve been working on Keen, a language that gives C a modern, Rust-inspired syntax and Cargo-like tooling without changing C’s underlying semantics.
Keen changes C’s syntax only. There is no borrow checker, no type checker, and no safety enforcement. All of C’s rules (integer promotion, ABI, linkage, UB) remain completely intact. Keen transpiles .kn files to C, hands them off to gcc or clang for semantic checking and compilation, and maps compiler diagnostics directly back to your .kn source lines via #line directives.
It's aimed at C developers who want modern ergonomics (modules, match, for i in 0..n, no header boilerplate, built-in testing/formatting) without giving up C's simplicity, or C devs looking to get comfortable with Rust's syntax before tackling the borrow checker.
use <stdio.h>;
struct Point { x: f32, y: f32 }
impl Point {
pub fn len2(p: *const Point) -> f32 { p->x * p->x + p->y * p->y }
}
pub fn main() -> i32 {
let p = Point { x: 3.0, y: 4.0 };
printf("%.1f\n", Point::len2(&p) as f64);
return 0;
}whet + keen): Includes keen new, incremental keen build, keen run, keen fmt (comment-preserving, idempotent), and keen test (runs #[test] functions in isolated processes).#include via use <stdio.h>;, drop down to raw C anytime with c!("..."), link existing .c/.o/.a files, or use keen emit --split to generate clean .h/.c files for existing C projects.pub handles external linkage while everything else defaults to static.GitHub: https://github.com/romishalom/keen
I'd love to hear your thoughts on the syntax mapping, edge cases with C interop, or what features you'd want to see next!
r/Compilers • u/Delicious_Abies_9708 • 2d ago
I've been working on a prototype for an MLIR-backed Vulkan Hardware Abstraction Layer (HAL) in response to https://github.com/modular/modular/issues/7413 and wanted to share it here for feedback: here is my attempt at it
Repo: https://github.com/billyblackburn/mlir-vulkan-hal-prototype
What it does:
Goal: [e.g., Lightweight, vendor-agnostic GPU compute execution in spirv]
Lowering pipeline: [e.g., linalg / gpu → spirv → Vulkan runtime dispatch]
Currently working: [e.g., Basic compute kernel lowering, buffer allocation, and dispatch]
What I'd love feedback on:
[e.g., Dialect/pass structure and whether the HAL boundary makes sense]
[e.g., Any pitfalls with SPIR-V lowering or Vulkan memory/descriptor management]
Happy to answer any questions or discuss the design choices.
r/Compilers • u/0xthiru • 2d ago
oksolc 0.2.5 now supports solc 0.8.37, 0.8.38 and 0.8.39, as well as solc 0.8.36.
Before oksolc 0.2.5, the compiler targeted only solc 0.8.36. A project pinned to a later release had no way to get the same bytecode from oksolc that its own solc produces.
oksolc is a new Solidity compiler written in Zig. It accepts the same Standard JSON input as solc, and on the 12 projects we measured it built 3.3 to 6.0 times faster than solc's via-IR pipeline.
We wrote it for our own use while developing Chainwall. The goal was shorter build times during contract development.
oksolc provides a command-line tool, a C library with the same interface as libsolc, and a Zig module. The supported compilation path is optimized via-IR through Standard JSON.
--solc-version selects any of the three earlier releases. The selected release controls pragma checks, code generation, diagnostics and metadata.block.slotnum and Yul slotnum() compile on the Amsterdam EVM version from the solc 0.8.37 target onwards.SOL-2026-4, SOL-2026-6, SOL-2026-7 and SOL-2026-8 in the Solidity compiler bug list. oksolc applies the same fixes on every target.returndatacopy calls that can revert keep their bounds checks.I compiled the 14 projects bundled with the oksolc benchmark with both compilers, on each of the three new solc releases. The complete Standard JSON output was the same every time. The README reports the same result for 17 workloads.
The solc 0.8.36 target keeps the security fixes and the constant-helper fix, so its bytecode can differ from solc 0.8.36. The README documents each difference.
For each project we sent the same Standard JSON build request to solc 0.8.39 and to oksolc 0.2.5 targeting solc 0.8.39. oksolc ran on 1 job and on 4 jobs. The benchmark records a result only when both compilers produce the same bytecode. Both compilers ran the optimized via-IR pipeline, so these times compare oksolc with solc via-IR, not with solc's default pipeline.
| Project | solc 0.8.39 | oksolc, 1 job | oksolc, 4 jobs |
|---|---|---|---|
| Sablier v2 1.2.0 | 523.1 s | 208.4 s | 145.9 s |
| EigenLayer 0.3.0 | 175.1 s | 77.9 s | 40.0 s |
| Solady 0.1.26 | 58.1 s | 29.2 s | 17.5 s |
| Uniswap v4 (2024-06-06) | 39.3 s | 18.2 s | 7.4 s |
| Pendle v2 (2026-09-16) | 26.0 s | 12.1 s | 6.8 s |
| OpenZeppelin 4.8.0 | 20.9 s | 9.7 s | 3.7 s |
| OpenZeppelin 4.7.0 | 18.9 s | 8.8 s | 3.2 s |
| Liquity (2024-10-30) | 14.7 s | 7.0 s | 3.4 s |
| OpenZeppelin 4.9.0 | 13.6 s | 6.4 s | 2.7 s |
| OpenZeppelin 5.0.2 | 10.8 s | 5.1 s | 2.0 s |
| OpenZeppelin 5.6.1 | 10.3 s | 4.9 s | 1.7 s |
| Uniswap v4 (2022-06-16) | 6.6 s | 3.1 s | 1.3 s |
With a single job, oksolc built every project 2.0 to 2.5 times faster than solc. With 4 jobs, it was 3.3 to 6.0 times faster. Building all twelve took 15 minutes 17 seconds with solc and 3 minutes 56 seconds with oksolc on 4 jobs.
Incremental builds are faster still. In a serve or watch session, oksolc keeps the compiler in memory and reuses work between edits.
I measured on my Apple Silicon MacBook Air with 16 GB of memory. The solc times and the oksolc 4-job times are the median of 3 runs after 1 warmup run. The 1-job times are single runs. On 4 jobs, oksolc used more memory than solc on most projects, for example a peak of 5.3 GiB against 2.4 GiB on Solady. Sablier v2 peaked at about 8 GiB with either compiler in these runs, and its three runs varied more than any other project's.
Sablier v2, the largest project in the set, went from 8 minutes 43 seconds with solc to 2 minutes 26 seconds with oksolc on 4 jobs, with the same bytecode.
You need Zig 0.17.1. Build oksolc from the release tag:
git clone https://github.com/okcontract/oksolc
cd oksolc
git checkout v0.2.5
zig build -Doptimize=ReleaseFast
./zig-out/bin/oksolc versionFor a Foundry project, point foundry.toml at the oksolc executable and enable optimized via-IR:
[profile.default]
solc = "/absolute/path/to/oksolc/zig-out/bin/oksolc"
via_ir = true
optimizer = true
optimizer_runs = 200Then run forge build as usual. If the project has artifacts from another compiler, run forge clean first.
This configuration builds with via-IR. If your project does not use via-IR today, the bytecode will differ from your current build.
Parallel compilation is off by default. Turn it on with an oksolc.toml next to foundry.toml:
parallel = true
jobs = 4The incremental compiler keeps its cache between runs only if you set cache = true in ~/.config/oksolc/config.toml.
Through Foundry, oksolc uses its default target, solc 0.8.39. To select another release, use the command line:
oksolc standard-json --solc-version 0.8.37 request.jsonoksolc can serve a local page for browsing a compiled project. It lists the project's source files next to the file you select, with an outline of everything that file declares.
For each contract the page also shows the ABI and the creation and runtime bytecode with their sizes. You can search the project, and two side panels list diagnostics and references.

The browser is left out of a default build. Build with -Dbrowser=true, which needs Bun 1.4.5 and TypeScript 7.0.2, then run it from your project:
oksolc serve --browseOpen http://127.0.0.1:8080. serve watches the Solidity files in src/ and recompiles when they change. To browse a single Standard JSON request instead, run oksolc browse --request input.json.
Including the browser adds about 0.3 MB to the binary.
What should it show next? Open an issue and tell us.
Build one of your own projects with oksolc and compare the result with solc. If the two differ, open an issue on github.com/okcontract/oksolc and include the output of oksolc version --json.
If oksolc is useful to you, star the repository. For new releases, follow us on X at u/okcontract.
r/Compilers • u/Key_Detail15 • 3d ago
In this post I just want to present the API for my own IR, as an example of what one might look like at a vastly smaller scale (compared to LLVM). I am not selling it, and I'm not giving any links (none exist anyway). It's just something different.
Only the high-level functions for managing an entire program are listed. 'PCL' is the IL name.
Possibly, it might be simpler than QBE, however QBE deals with only a small part of the pipeline (it turns SSA text into ASM text).
proc pcl_start (int nunits = 0) # (Syntax is my systems language.)
proc pcl_end
func pcl_runpcl :int
proc pcl_genmcl
proc pcl_genss (int obj = 0)
proc pcl_exec
proc pcl_writeexe (ichar filename) # ('ichar' is like char* in C)
proc pcl_writedll (ichar filename)
proc pcl_writeobj (ichar filename)
proc pcl_writemx (ichar filename)
func pcl_writeasm (ichar filename = nil, int atype = 'AA')ichar
func pcl_writepcl (ichar filename = nil)ichar
func pcl_writepst (ichar filename = nil)ichar
func pcl_writess (ichar filename = nil, int obj = 0)ichar
proc pcl_cmdskip (int cmdskip, psymbol dcmdskip = nil)pcl_start Start a new IL program and ST. The optional 'nunits' argument gives an estimate of the program size.
At this point, there is set of 40 lower-level functions, starting with 'pc_' and 'gen_', used to build IL code, data and symbols. This is done for an entire program as this is designed for whole-program compilation.
This library uses a single global context so no context handles need to be returned or passed.
pcl_end Write an end-of-program marker. This IL program is now complete.
pcl_runpcl Run the program via interpretation of the IL. This is not fast or efficient, but it is useful for debugging, experiments, profiling or for fun. The return value is the program exit code.
pcl_genmcl Turn the IL into a native code representation. Mainly this is for x64/Windows. Experimental backends have been done for 8-bit Z80, with a brief foray into ARM64/SYS V.
pcl_genss Turn the native code representation into binary machine code.
pcl_exec Fix up the binary machine code and run it in memory.
pcl_writeexe pcl_writedll Write Windows EXE or DLL files.
pcl_writeobj Write an object file in PE+ format (this is the only time a linker is needed)
pcl_writemx Write the program in my private executable binary format
pcl_writeasm Dump as ASM source to a file or string. Supports four formats: AA (mine), NASM, GAS, and MASM, although usually only one is configured in a particular build.
pcl_writepcl Dump as IL source code to file or string. This is for debugging mainly but the result can represent an entire program (see below).
pcl_writepst pcl_writess Write the IL symbol table or dump the generated binary to a file or string.
pcl_cmdskip This is to do with moving the command line parameters when invocation is complex (see example below).
The call-pattern to generate an EXE file say might be:
pcl_start()
genpcl() ...
pcl_end()
pcl_writeexe(outfile) # calls pcl_genmcl/pcl_genss if neededThe above library is normally built-in to a compiler. The library can also be built into a standalone DLL, a dynamically linked library. I might do that if I wanted to use it from my scripting language, say.
What I don't have in this API is a way to read textual IL from a file. That is done in a standalone application that contains the necessary front-end.
Some stats for this library that includes all the above:
Line count: 17 Kloc
Build time: 60 msec
EXE size: 180 KBJIT This is not needed since compilation is so fast.
Optimisation That is not used, but generated code is decent: typically within a factor of two of optimised code.
(Shortened and edited.)
r/Compilers • u/Severe_Landscape_731 • 3d ago
(19M, Nepal(south asia)) I am currently in the third year of my ug and am fascinated by this field and preferably want to continue it till masters or pHd if i can get one . unfortunately i come from pretty strapped background and would need to sustain myself , but dont really have enough judgement to discern what implications of ai would be here, and if i should really continue.
I am also find doing lc pretty enjoyable , but i dont think that skill would be any valuable here.
Thanks , i would really appreciate your input.
r/Compilers • u/naharashu • 3d ago
What is better?
r/Compilers • u/Ok_Savings_7482 • 4d ago
I wanted to see if TypeScript could get a rustc-style checker: query-based, incremental, and designed to be embedded. It's a from-scratch semantic engine, not a port. I skipped writing a parser and built on Oxc, so the work goes into the hard part: types, generics, flow narrowing, and cross-file incremental checks.
```
TS source → Oxc (parse, scopes) → bridge → tsox semantic core → diagnostics
```
What it does today
- Matches tsc exactly on 56.6% of the TypeScript v6.0.3 test corpus (8,072 of 14,274 files). The corpus is the whole release: single-file, multi-file and JSX cases.
- Checks classes, generics with inference, `keyof`, conditional types with `infer`, overloads, async and narrowing.
- Re-checks only what an edit reaches, through a Salsa-backed project engine.
- Ships an LSP (diagnostics, hover, completion, go-to-definition, references, rename), VS Code and Zed extensions, and a WASM build.
How it's built
- Queries: every semantic question is memoized, so an edit re-runs only the queries it touches.
- Cycles: import cycles are resolved as strongly connected components.
- Types: they're interned IDs in one arena, so type equality is an integer compare.
- Rules: they're table rows, so adding a rule means adding one line.
What it doesn't do yet
It's experimental. It misses some errors that tsc reports and, less often, reports one that tsc doesn't. I publish the gap with every change, measured against the corpus, so you can see exactly where it stands.
A note on speed and memory
I'm deliberately not publishing speed or memory numbers. tsc and the other full checkers check every file completely. tsox doesn't yet: it still skips, or only partly checks, a large share of what tsc checks (the 43.4% of the corpus that doesn't match exactly), so its times and memory use would be for less work. A comparison like that isn't correct, however good it looks. I'll publish numbers once tsox checks the same things they do.
How you can help
- Conformance triage: pick a diagnostic code, read what tsc does, and write the smallest fix that turns a batch of files into matches.
- Fixtures: a failing case in `tests/fixtures/` is how most changes start.
- Real code: try it on your own TypeScript and open an issue where it disagrees with tsc.
To try it
```bash
git clone https://github.com/tsoxide/tsox.git
cd tsox
bash scripts/ci.sh
```
AI-assisted PRs are fine. I use an assistant too, so please read and test what you send and say so in the description.
r/Compilers • u/Beautiful_Brick9412 • 4d ago
r/Compilers • u/vu_N • 4d ago
Hi there, im working on a apk to source decompiler tool chain with full game compiled and run smoothly on almost any IL2CPP Unity game apk/ipa. Actually i have done for almost 40 games top of market focus on hybrid casual even the liveops part. Some game with pairIP anti Frida and BeeByte Obf still can break. But im not sure about public the kit since i dont know how it will impact. The de-compilation process took 1 day for everage size game to 5 days on massive game with million lines of code decompiled with LLM support.
r/Compilers • u/naharashu • 4d ago
Just found it, and it seems more easily to understand than LLVM IR
r/Compilers • u/adityazero • 4d ago
A recent news where NEAR AI reported that an attacker exploited a RCE vulnerability in SGLang exposing account details etc.
At this point it seems like we need a better way to program inference systems. As per Claude's research and SGLang's published RCEs this year share a pattern: Python features that run code by design, exposed to the network.
This is where *capability types* can help programmers and tools and AI reason about the attack surfaces. Vx is in early stages so adding capability types is not too difficult at this point but I'd like to learn from someone who has done it before.
r/Compilers • u/Hopeful-Ad-1665 • 5d ago
Hey r/Compilers !
A while back, I started building FoxVC—a lightweight, zero-dependency scripting language and bytecode virtual machine designed around 25 deterministic keywords
(act, emit, pick, alt, spin, pulse, etc.).
Like a lot of hobby language projects, it originally started with a classic architecture: a Python frontend (lexer, AST parser, bytecode compiler) that called
into a fast C VM (foxvm.so) via ctypes.
It was fun, it worked, but eventually, I hit what I call the "3-language duplication trap":
1. You write a feature in Python.
2. You have to sync it with your C VM.
3. Then you want a WebAssembly browser playground, so you end up maintaining a third JavaScript parser that slowly drifts out of sync.
4. Worst of all: cold-start latency sucked. Spawning Python just to parse a 20-line .fox script took ~200ms before the C VM even touched the first bytecode opcode.
Over the last few weeks, I pushed two massive updates—v2.0.0 (Engine 0.7.0) and today’s v0.7.1 “Titan” update—to completely overhaul the engine.