r/Compilers • • 19h ago

Fid : systems programming

Post image
0 Upvotes

Hi everyone

I've been working on my own programming language for some time, and I'm now looking for developers willing to test it, experiment with it, and provide honest feedback.

The project is called FID. It's a low-level, general-purpose programming language designed with several use cases in mind:

  • Systems programming
  • Embedded systems and electronics
  • Robotics
  • Operating systems
  • Software development
  • Server and backend development
  • AI infrastructure

I've taken considerable inspiration from Rust, but I wanted to explore a different approach to some of the challenges developers face when working with low-level languages.

Key features and design goals

  • Memory Safety: Compile-time memory safety checks without requiring Rust's lifetime system.
  • Built-in Security: Native capabilities-based permissions and an Effects system.
  • Native Performance: Compiles to native code without requiring a garbage collector.
  • Memory Management: Region-based memory management for greater control over allocation and deallocation.
  • Low-Level Control: Direct hardware access with an emphasis on safety and security.
  • Independent Compiler: Its own compiler, without mandatory reliance on LLVM.
  • Simplicity: Bringing together ideas from Rust, C, and Zig while exploring ways to reduce some of their respective limitations.

Compiler Architecture

FID is designed around an independent, modular compiler architecture, with a clear separation between the language frontend, compilation pipeline, optimization stages, and target-specific code generation.

The compiler is structured around several main layers:

  1. Frontend: Handles source-code processing, parsing, syntax analysis, and AST generation.
  2. Semantic Analysis: Performs type checking, compile-time validation, memory safety checks, lifetime inference, and Effects analysis.
  3. Intermediate Processing: Transforms and prepares the program for subsequent compilation stages, allowing the compiler to analyze and optimize code independently of the target platform.
  4. Optimization Engine: Handles compiler optimizations such as constant folding, dead-code elimination, inlining, and other performance-related transformations.
  5. Code Generation: Uses FID's own code-generation infrastructure to produce native executables without mandatory reliance on LLVM or an external compiler.
  6. Target Backend: Handles platform-specific requirements, including architecture, operating system, executable formats, and ABI conventions.

One of the main goals behind this architecture is to keep the compiler independent from external toolchains while maintaining flexibility across different platforms.

Current Development Status

The initial compiler was written in Rust. FID is a compiled language with self-hosting support, meaning it can compile its own source code.

The compiler is developed independently, and native compilation does not depend on LLVM.

The project is still in its early stages, so I'm not presenting it as a production-ready alternative to established languages. I'm looking for developers who enjoy experimenting with new technologies and are willing to challenge the design, identify bugs, and suggest improvements.

How You Can Help

I'm currently looking for 5 testers to try the language and share their experience.

If you're interested, you can:

  • Try the language and report bugs.
  • Share feedback about its design and features.
  • Suggest improvements or missing functionality.
  • Star the GitHub repository and follow our organization to support its visibility.

Links:

I'm particularly interested in hearing from Rust, C, C++, and Zig developers.

Honest criticism is more than welcome. I'd rather have people point out flaws in the design now than discover them much later in development.

To be clear, the language is still in its early stages of development and is not yet production-ready.

Thanks for reading!


r/Compilers • • 4h ago

i wrote my own programming language

Thumbnail github.com
5 Upvotes

Ribbath

Ribbath is a Rust-native web framework for file-based routing, server-rendered .rib templates, and static exports. darkrib is its component kit, with light and dark themes and self-hosted Montserrat.

Live demos: native framework demo (this repository, deployed from the static export) · legacy JavaScript toolchain example

I’m still new to this journey—it’s my first experience—and I really hope it goes as I’ve envisioned. I’d be so happy if you could star the project on GitHub. Thanks!


r/Compilers • • 12h ago

New MIT-Licensed Ramanujan interpreter beating CPython: performance matrix

0 Upvotes

Motivation

Ramanujan is built as the execution runtime for a distributed volunteer computing platform[Ramanujan-Computing]. In traditional volunteer computing projects, researchers have to cross-compile and ship platform-specific native binaries for every OS and architecture whenever they introduce a new problem. With Ramanujan, simulation writers simply write standard Python code once, and the lightweight runtime executes its IR deterministically across heterogeneous volunteer devices—from desktops to Android phones, smart TVs, and smart appliances where shipping CPython's full runtime overhead isn't practical

Summary

Ramanujan runs a statically typed subset of Python through a native interpreter. I wanted to see how it compares with CPython on one machine. I ran 34 CPU-only workloads, from a 42-line Mandelbrot script to a two-pass assembler, graph algorithms, and object-heavy data structures like segment trees and tries. Both engines ran the same Python source without changes.

On an Apple M3, the geometric-mean speedup was 1.92× against CPython 3.12.2 running precompiled .pyc files directly, and 1.69× with CPython's -S flag, which skips importing site. These are whole-process timings, not interpreter-loop timings: startup, loading, execution, and shutdown are included, as is Ramanujan's IR linking. Source compilation is excluded on both sides.

In a separate memory benchmark, Ramanujan had a lower median peak physical footprint on 32 of 34 workloads. Across the suite, CPython's footprint was 1.63× Ramanujan's (geometric mean of the per-workload ratios). Unlike the timing runs, the memory runs used .py source for CPython, not .pyc files.

Wall time

Median / p99 in milliseconds, from 100 interleaved fresh-process runs per workload and configuration. Ramanujan runs native X.pb <entry> 1; CPython runs python3 X.pyc or python3 -S X.pyc (-S skips importing site). Neither timing includes source compilation. Both include process startup, loading, execution, and shutdown; Ramanujan also links its IR on every run. Speedup = CPython median / Ramanujan median.

Ramanujan had a lower median on all 34 workloads against both CPython baselines.

OOP workloads (20)

Geometric-mean speedup: 2.07x vs default CPython; 1.78x vs -S.

WorkloadRamanujanCPython .pycCPython -S .pycSpeedupSpeedup vs -S
method-reuse8.29 / 10.1119.19 / 20.2616.74 / 18.802.32x2.02x
factory-return5.79 / 6.3513.16 / 16.5310.85 / 11.432.27x1.87x
polymorphic-dispatch12.87 / 15.3729.95 / 31.8227.55 / 28.862.33x2.14x
none-linked-list6.59 / 16.4714.96 / 26.6412.60 / 22.412.27x1.91x
bst-none-children9.36 / 10.1116.93 / 18.8014.58 / 15.741.81x1.56x
isinstance-dispatch13.32 / 16.8248.17 / 50.7445.81 / 47.503.61x3.44x
type-reflection10.16 / 12.6725.77 / 26.7123.43 / 24.262.54x2.31x
static-class-methods21.20 / 24.9061.60 / 63.2459.20 / 67.812.91x2.79x
abstract-interface14.97 / 24.2533.97 / 65.1831.34 / 49.562.27x2.09x
none-checks10.32 / 11.9527.62 / 33.3425.19 / 28.722.68x2.44x
linked_list4.86 / 5.749.20 / 11.056.92 / 8.571.89x1.42x
trees7.66 / 8.0511.86 / 12.569.57 / 10.321.55x1.25x
heap5.25 / 5.659.42 / 10.317.09 / 8.001.79x1.35x
graph6.24 / 7.4210.01 / 10.947.60 / 8.261.60x1.22x
lru_cache15.86 / 16.3625.23 / 26.7423.01 / 24.001.59x1.45x
expression_tree6.21 / 7.1011.07 / 12.908.80 / 10.201.78x1.42x
union_find9.79 / 10.4816.09 / 17.6613.69 / 14.801.64x1.40x
skip_list12.69 / 14.5520.05 / 21.0417.26 / 18.181.58x1.36x
trie21.48 / 28.8133.22 / 57.6530.66 / 44.271.55x1.43x
segment_tree8.78 / 10.3622.69 / 24.5420.17 / 22.362.58x2.30x

Plain workloads (14)

Geometric-mean speedup: 1.73x vs default CPython; 1.57x vs -S.

WorkloadRamanujanCPython .pycCPython -S .pycSpeedupSpeedup vs -S
assembler11.00 / 25.9819.53 / 52.5816.89 / 42.921.78x1.54x
expression_compiler24.55 / 26.2629.45 / 31.9326.93 / 28.311.20x1.10x
bignum18.24 / 36.1930.53 / 42.7228.00 / 56.171.67x1.53x
ntt19.90 / 21.7046.56 / 51.0144.22 / 49.522.34x2.22x
lz779.26 / 12.0518.36 / 23.6815.96 / 22.051.98x1.72x
sorting32.91 / 39.2947.88 / 75.6545.56 / 79.991.45x1.38x
dynamic_programming20.04 / 23.9127.50 / 29.3424.99 / 29.191.37x1.25x
graph_algorithms17.01 / 18.1328.64 / 30.1026.14 / 28.651.68x1.54x
number_theory57.82 / 61.5990.42 / 97.5886.10 / 88.211.56x1.49x
sudoku11.78 / 12.3720.87 / 21.5818.37 / 20.811.77x1.56x
nqueens8.25 / 9.0513.17 / 15.4310.75 / 13.091.60x1.30x
nbody12.66 / 27.1523.46 / 36.3220.78 / 32.061.85x1.64x
mandelbrot20.45 / 22.8948.99 / 53.0746.66 / 49.612.40x2.28x
heat_stencil24.13 / 30.9248.61 / 53.8646.15 / 48.452.01x1.91x

Peak physical footprint

Median MB from 100 interleaved fresh-process runs per workload and engine, measured with macOS /usr/bin/time -l. These are separate from the timing runs: CPython ran python3 X.py (source), and Ramanujan ran native X.pb <entry> 1. A ratio above 1 means Ramanujan used less memory.

Across all 34 workloads, the geometric mean of the CPython / Ramanujan footprint ratios was 1.63x; Ramanujan was lower on 32 of 34.

OOP workloads (20)

WorkloadRamanujan (MB)CPython (MB)CPython / Ramanujan
method-reuse1.915.342.80x
factory-return1.925.162.68x
polymorphic-dispatch1.955.202.66x
none-linked-list1.975.362.72x
bst-none-children2.505.642.26x
isinstance-dispatch2.025.142.55x
type-reflection1.975.172.63x
static-class-methods2.095.162.46x
abstract-interface2.035.142.53x
none-checks2.025.172.57x
linked_list3.725.661.52x
trees4.435.881.33x
heap4.205.621.34x
graph5.786.031.04x
lru_cache3.805.631.48x
expression_tree3.845.801.51x
union_find4.116.021.47x
skip_list3.865.951.54x
trie4.176.191.48x
segment_tree3.775.661.50x

Plain workloads (14)

WorkloadRamanujan (MB)CPython (MB)CPython / Ramanujan
assembler4.035.781.43x
expression_compiler4.695.851.25x
bignum4.345.821.34x
ntt3.895.551.43x
lz774.955.751.16x
sorting5.635.971.06x
dynamic_programming8.026.040.75x
graph_algorithms6.196.110.99x
number_theory6.206.731.09x
sudoku4.035.861.45x
nqueens2.415.412.25x
nbody3.705.611.51x
mandelbrot3.735.341.43x
heat_stencil3.165.501.74x

r/Compilers • • 3h ago

Is it inevitable for all mature languages to move to LLVM or write their own backend?

7 Upvotes

For a month I have been writing a compiler for my own language. I started testing it from last few days to port C programs like Puff.c and JSMN. It's closed source, and being honest: it's miserably slow. The basic idea was a Go-Rust like ARC with contracts. I broadly understand that you can only take three ways:

  1. LLVM backend
  2. Clang which is LLVM's optimizer, but C is the ceiling: This is my case.
  3. Write your own backend: A task too big to even entertain at prototype level.

Only language which takes the second route, and comes out as fast is Nim, but I am not sure how it works under hood. They are also developing Nimony(worth a look) to take a new approach before Nim 3.0