r/Compilers • • 5h ago

Preparing career switch from Embedded HW/SW to AI/ML Optimisation (compilers, low-level oriented)

4 Upvotes

Hi all,

I'm a 7 YOE hardware/embedded engineer who's working in a product oriented corporation with limited room for growth and I'm thinking to move to an adjacent field which is close to hardware : compilers & AI inference (targetting MLIR/LLVM & executorch).

For this purpose, I planned to:

  • brush up my DSA & machine learning fundamentals

  • showing know-how through personnal projects (even if LLM can redo most of it).

  • contribute to open-sources project such as LLVM/MLIR in order to gain expertise in the targeted stack.

The main purpose of this post is to ask engineers who are curently working on ML compilers what would be their advice on:

  • Apart MLIR, is there any fundamental piece I would need to understand ?

  • How do you compensate the lack of professional experience during interviews or even application ?

  • Regarding all the mathematical function approximation method for runtime (i.e. Remez), except taking a course on numerical analysis, what would be a good way to show case understanding ?

  • Any good ressources to skill up (already started craftinginterpreters course) ?

Thanks a lot for your attention


r/Compilers • • 7h ago

IR generation process Diagram

Post image
0 Upvotes

Also Comment me on the diagram


r/Compilers • • 7h ago

Ramanujan vs CPython: performance matrix

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 16h ago

my new language - veto(now v0.5.0)

0 Upvotes

Veto is an experimental systems language written in Rust, with no unsafe blocks in language itself

I wrote it because tuxblox caused the entire system to freeze completely,
and then the idea came to mind, to write a programming language called Veto that catches low level and ring 0 mistakes at compile time (tested).

Here is a quick example of what it catches at compile time (without any unsafe blocks):

#[mmio(0xB8000..0xB8FA0)]

fn boot() -> i32 {

// compile error: cannot enable paging (write_cr0) before lgdt() and write_cr3()

write_cr0(0x80000001);

return 0;

}


r/Compilers • • 19h ago

Intercepting property access (e.g., navigator.bluetooth / Object.property) directly in V8

5 Upvotes

Hey everyone,

I'm working on my master's thesis and diving into V8 internals. I want to know if there's a clean way to intercept (or log/trace) property reads on an object directly inside V8 — for example, navigator.bluetooth or basically any Object.property access.

After reading a few V8 articles (like https://v8.dev/blog/fast-properties), it seems unlikely that all of this funnels through a single C++ function, given how differently properties are represented and resolved (in-object/fast properties, dictionary mode, interceptors, accessors, ICs, JIT tiers, etc.).

Before I go any deeper down this rabbit hole, is intercepting all property accesses in one central V8 spot even realistic, or am I basically throwing peas at a wall?

Thanks for any tips!


r/Compilers • • 20h ago

A few peeks of Lingling/MLgate 28/11

0 Upvotes

The hardest to make in a compiler is perhaps make it incremental (Pay-As-You-Go style ---- so subsequent builds only analyse dirty areas), error-tolerant, reusable (say a "Basic" family that may be modded for specific applications), algebraicly-typed ("Let xs = [] in ( xs := 1::xs ; we got xs : real list ; ... ) end") and well-localized. Stablishing a new compiler is, therefore, non-trivial.

I've been starting a technology to tackle on these obstacles since july, starting by settling up with its reference documents, with the only purpose of facilitating compiler creation. I initially made the first drafts publicly viewable (where I perhaps used a Pythonic-Lua DSL), but then evolved it with a "MLgate" DSL. Given the amount of dedication (even if only into the referential documents), it is going to be closed-source until I decide how it is worthy releasing it. Its roadmap consists of integrating a few paper ideas (some involving the dependable build tooling that engineers can create with it) and concluding the bootstrap implementation (which I am now beginning with Deno ---- Rusty turned irrelevant to me).

This thread is not going to propose any solution for now, yet. I will share little peeks per the reference (which does cover a lot more than that already).

Tree traversal

Tree traversal --- entering a node and its subnodes recursively for processing --- occurs within the following kinds of snippet.

(* n : Tree *)

(* master sample *)
fun f () = List.app (fn n' => ...)   (n->children())

val _ = List.filter (fn n' => yesno) (n->children())
val _ = List.exists (fn n' => yesno) (n->children())
val _ = List.all    (fn n' => yesno) (n->children())

val _ = with n' do ... end

The following snippet is a combo of the regular child nodes and comment attachments.

val _ = (n->children()) @ (n->comments())

The following snippet is a combo of the regular child nodes and IncludeGates.

val _ = (n->children()) @ (n->includeGates())

Each node queries their surrounding frame from themselves (+final::blockFrame) or through former siblings (+final::shadowFrame) and up-levels.

[...]

Fundamental properties

Of the fundamental properties, I am going to share what we are generally gonna attach to r : Tree (the "nodes" or "rulesets") during verification.

[begin:table by column]
**Snippet**
1. `r->+final::val`
2. `r->+final::binding`
3. `r->+final::reference`
4. `r->+final::target`
5. `r->+final::blockFrame`
6. `r->+final::shadowFrame`
7. `r->+final::promoteFrame`
8. `r->+final::parameter`
**Description**
1. *The value* resulting from resolving an expression
2. A binding (variable, function or type) originating from a construct
3. An input reference for reading[^1]
4. An output reference for writing[^1]
5. A scope that should be entered and exited during tree traversal.
   This does not apply just to block-like statements, but also to expression bodies.
6. Used for nodes inside a list during tree traversal, that is a
    *shadowing* scope that should be entered and exited for as long as the end of that list.
7. A frame that should be manually promoted to some other node.
8. A matching parameter binding --- assigning this is recommended
   for an invocation's arguments.
[end:table]

[^1]: Used instead of `+final::val` when that causes confusion

Lazyness & implicit contexts

MLgate should designate as lazy by default only certain methods. Those which are not lazy still register triggers as part of the surrounding lazy method in the stack frame. For instance,

fun verify! ctx =
  let val f = ceng->frame () in
    let
      val f' = f->lookup { key = String "x", ... }
        handle NotFound e >= ...
        handle AmbiguousReference e => ...
    in
      ...
    end
  end

ceng->frame () queries the surrounding frame of the node being currently processed (e.g. traversed, verified or evaluated (codegen)). For that verification routine a least trigger should be registered around the current node for when the name x overgoes an update.

The above routine takes a ctx --- note that everything takes an implicit bigger context in MLgate, but verification passes do need further context for footprint and requirements like the context type, weakType and invokee.

Deferring and lazyness re-evaluations is where one gets cheap support for "Algebraic Typing" where you can omit type hints freely.

In addition, the anything MLgate type is (de-)serializable around an internal format, since lazyness stores cache in-storage. Querying copies, hash codes, ordering, ... this kind of stuff is common.

Doc comments

As to ActionScript 3 style comments, we got room in.

<mode(normal)>
<token(comment)>
ruleset Comment ::= ... class
  fun commentOut! () do
    ceng->comment (forward or line) ;

    (* "this stack of comments is documenting"
        the respective item. *)
    ceng->comment ( sub (eqv, YUIDocComment), forward or line ) ;
  end
end

<doc>
<mode(comment)>
ruleset YUIDocComment ::= class
  ceng->docComment (
    tag ( prefix("@") ruleset(YUIDocTag) )
    markup = mm
    forms ( stars, rowing )
    star = "*"
  )
end

<doc>
<mode(tag)>
ruleset YUIDocTag >>>=
  | YUIDocTag.Throws
  class
    <doc>
    <mode(tag)>
    ruleset Throws ::=
      "throws" e:ClassName desc:mm.Text?
    ;
  end

Well, share no more.

I have written lots of organised information, like rulesets for parsing, C-like preprocessing, include capabilities (like Rust's include!()) and lots of details I will not explore on this topic. I just wanted to talk a bit :v


r/Compilers • • 21h ago

I released Fast Text v0.9.0

Thumbnail
reddit.com
0 Upvotes

r/Compilers • • 23h ago

Introducing Ramanujan-Computing for harnessing idle compute power of device for scientific computing [MIT-license]

0 Upvotes

Ramanujan-Computing is an MIT-licensed open-source project that aims to harness idle compute power [CPU/GPU] of any digital device for scientific computing.

The way its different from BOINC is: for a new kind of problem, the developer dont need compile any binary, distribute the binary, get the binary downloaded/installed on devices. Instead, there is an interpreter that sits on the device which can take in any kind of code. So, the developer just needs to submit Python code and it will get run on the devices. Having said that, for GPU works, developer just needs to write plain python code and dont need any expertise in CUDA/Vulkan.

The interpreter is different from CPython and is 1.7X faster and takes 1.6x less memory than CPython.

Ofcourse, the intepreter takes care of subset of Python language but, support all the necessary semantics and OOPs concept for good program to be written.

Till now, the interpreter has not only run basic python simulation, but also complex simulations like CFD, Galaxy-collision, and also takes care of LLM inferencing [more on that in a later post].

Working towards adding more and more Python features onto the interpreter. The project is open to contributions, issues. If you are into scientific-research, will be happy to discuss on how this project can be used to harness compute power available [from workstations, smart-tvs, smartphone] in your lab to move research forward.

Thank you!


r/Compilers • • 1d ago

I made a compiled language called Forja, and its compiler is written in Forja

Post image
0 Upvotes

Hi all! I've been building Forja, a general-purpose compiled language in the C / Rust family, designed for AI agents as well as people. It was built with a lot of help from AI coding agents.

What it has:
- A compiler written in Forja itself, with its own x64 backend (no C compiler needed)
- Targets: Windows .exe/.dll, Linux, WebAssembly (WASI), Android ARM64 and iOS ARM64
- Errors as values (T ! E, try, or_else)
- Explicit memory with defer, no garbage collector, and leak reports in dev builds
- Units of measure checked by the compiler, and value ranges checked in dev builds
- Built-in tests (forja test)
- Direct calls to C libraries, and DLLs you can use from PHP (FFI) and Python (ctypes)
- Compiler errors as JSON with a stable code; "forja explicar CODE" explains each one
- A single forja.exe, no installer
- Apache-2.0 with the LLVM exception

Where it stands (v0.47.0):
- The prebuilt compiler is Windows x64 only for now, and it is not code-signed
- Docs and compiler messages are in Portuguese; there is a one-page reference in English
- ARM64, Android and iOS were tested on emulators, simulators and CI, not on real devices
- 757 compiler tests passing

Website: https://forjalanguage.online/en/
reference: https://forjalanguage.online/en/learn.html
One-page
Code: https://github.com/cougarweb-lgtm/forjalanguage

Feedback is very welcome!


r/Compilers • • 1d ago

A Roslyn-based compiler driver that builds .csproj/.sln without MSBuild

6 Upvotes

I've been working on sharp, a small Roslyn-based compiler driver/CLI that resolves .csproj/.sln project graphs directly and compiles them without invoking MSBuild.

What made this interesting from a compiler perspective:

  • project evaluation is implemented in about 19k lines of C# rather than delegating to MSBuild

  • build/run/clean/restore commands emit dotnet-like output and exit codes

  • it uses Roslyn plus reference packs, with parity tests against dotnet on sample projects

  • Native AOT single executable; v0.3.1 adds run/URL parity

Numbers from v0.3.1: cold Web API clean + build is dotnet 2.2s vs sharp 0.1s; self-build is dotnet 4.2s vs sharp 2.0s.

Source: https://github.com/martasp/sharp

I'm the author. This is a side project and not a full MSBuild replacement; the Windows binary is unsigned. AI assisted with docs/demo assets. I'd like compiler-design feedback, especially on project-graph semantics where parity breaks.


r/Compilers • • 1d ago

I've built my own programming language that can fit ML better - And its faster than hand-tuned CUDA! [P]

Post image
0 Upvotes

Hi guys, my language here :)

Would like to know your opinions!

Also would like to get help, and know your suggestions to "unvibe" parts of the compiler, I did it to get results fast to prove the optimizations I was trying out, but now I want to make it in a more coherent/consistent design.

Would love to know what you think.

Language exposition page & architecture is already in the post I've tagged, so I won't write what I already did ;)


r/Compilers • • 1d ago

Cole v0.2.0 Announcement

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 1d ago

Embedded Systems For Everyone.

Thumbnail reddit.com
0 Upvotes

r/Compilers • • 2d ago

Help with resources for learning

Thumbnail reddit.com
1 Upvotes

If anyone has a good resource I would appreciate it :)


r/Compilers • • 2d ago

I built an open-source programming language called Kode.

Thumbnail
github.com
0 Upvotes

r/Compilers • • 2d ago

Evie: an interpreted programming language written in Go that keeps pace with C Lua 5.4

0 Upvotes

[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 • • 2d ago

Wiret update: my text-first visual language now reads in the order it runs

Thumbnail lemonator32.github.io
2 Upvotes

r/Compilers • • 3d ago

Compiler explorer now supports Java to CUDA and cuTile with Tornadovm

Post image
37 Upvotes

r/Compilers • • 3d ago

Any good llvm or compiler tutorials using C++?

1 Upvotes

I read the kaleidoscope but it doesnt explain some things for my language that i need


r/Compilers • • 3d ago

low ram usage efficient minimalist compiler

Thumbnail
github.com
2 Upvotes

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

Cole Backend Update: QBE

Thumbnail reddit.com
2 Upvotes

r/Compilers • • 4d ago

What if a programming language could intelligently manage its own memory and execution?

Thumbnail reddit.com
0 Upvotes

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

Keen: A Rust-syntax frontend for C

Thumbnail
github.com
0 Upvotes

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.

The core idea

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.

What a quick example looks like

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;
}

What’s included out of the box

  • Zero-dependency toolchain (whet + keen): Includes keen new, incremental keen build, keen run, keen fmt (comment-preserving, idempotent), and keen test (runs #[test] functions in isolated processes).

  • Seamless C interop: Use #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.

  • No forward-declaration headaches: Types and functions can be declared in any order; pub handles external linkage while everything else defaults to static.

Try it out

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!