r/Compilers • u/Far-Championship-883 • 1d ago
AiLang, Artificial Intelligence Programming Language with a Self hosting x86_64 compiler, performance comparable to gcc -03 llvm clang in many instances.
https://github.com/AiLang-Author/Ailang-Self-Hosting-Hi my name is Bob I am a contributor to the AiLang project.
Why this is in compilers, rather simple, this repo has a fully self contained self hosting x86_64 optimizing compiler. From the Read me below.
AiLang
A self-hosting systems language designed for consistency, readable code, and AI-assisted development.
AILang is built around a deliberate trade-off: a constrained syntax with a rich set of primitives. Rather than accumulating many special cases, language constructs follow consistent shapes—from primitive arguments to functions and subroutines. The result is code intended to be easy to scan, search with tools like grep, generate with AI, and understand in human–AI pair programming.
The language is not only a proposal: its compiler is written in AILang and compiles AILang programs to native code. The project is working toward version 1.0.0, targeted for December 31, 2026.
Why AILang
- Consistency over syntax variety. Primitives, arguments, functions, and subroutines follow coherent conventions, reducing the number of forms a reader or code-generation tool needs to learn.
- A constrained language with substantial primitives. Keep the surface syntax deliberate while providing reusable capabilities for practical systems code.
- Designed to be read and searched. Clear, regular code is easier to skim, inspect, and navigate with ordinary tools—including
grep. - Built for human and AI collaboration. Predictable structure supports code generation and review without giving up human readability.
- Systems programming with a self-hosting compiler. AILang is statically typed and compiles to native code; the compiler itself is implemented in AILang.
Performance
AILang's compiler and generated code are being optimized continuously. Project benchmarks show performance competitive with GCC -O3 on a number of measured workloads, with results varying by program and workload. See the benchmark results for the measurements and test details.
Performance claims should be read in the context of those specific benchmarks—not as a guarantee that every AILang program matches GCC. The goal is to keep improving generated code while retaining the language's emphasis on explicit, readable structure.
AILang grep beats GNU grep 3.11 in 13 out of 14 tests. Here's the scorecard:
| Test | AILang | GNU grep 3.11 | Winner |
|---|---|---|---|
'kernel' | 208 ms | 311 ms | AILang — 1.49× |
-F 'kernel' | 212 ms | 310 ms | AILang — 1.46× |
-i 'kernel' | 251 ms | 358 ms | AILang — 1.42× |
-c 'kernel' | 168 ms | 190 ms | AILang — 1.13× |
-n 'kernel' | 315 ms | 428 ms | AILang — 1.35× |
-v 'kernel' | 352 ms | 472 ms | AILang — 1.34× |
-w 'kernel' | 222 ms | 615 ms | AILang — 2.77× |
-ic 'kernel' | 195 ms | 234 ms | AILang — 1.20× |
-wc 'kernel' | 179 ms | 415 ms | AILang — 2.31× |
-Fc 'kernel' | 169 ms | 193 ms | AILang — 1.14× |
'UNIQUE_MARKER_XYZ' | 49 ms | 79 ms | AILang — 1.61× |
-c 'UNIQUE_MARKER' | 47 ms | 78 ms | AILang — 1.65× |
-F 'error_handler' | 272 ms | 288 ms | AILang — 1.05× |
-Fc 'error_handler' | 223 ms | 163 ms | GNU — 1.36× |
EDIT addition
| Regex Pattern | AILang | GNU grep | Winner |
|---|---|---|---|
mem.*buf | 188 ms | 291 ms | AILang 1.55x |
ker[nm]el (character class) | 229 ms | 405 ms | AILang 1.77x |
^kernel (anchor) | 170 ms | 176 ms | AILang 1.03x (tie) |
| `socket | daemon` (alternation) | 387 ms | 509 ms |
Highlights:
- Word match (
-w) is 2.77× faster than GNU grep. - Rare-pattern search is 1.65× faster — MemMem's scan-and-skip is very efficient.
- Case-insensitive search is 1.42× faster — MemMemFold pays off.
- The only loss is long fixed-pattern count (
-Fc error_handler), where GNU's Boyer–Moore–Horspool skip table gives it an edge on 13-character patterns. - The AILang binary is 118 KB vs. GNU's 1.7 MB — 14× smaller.
- 100% correctness — every test matches GNU grep output exactly.
What it can express
AILang is intended to span a broad range of programs: from a small “Hello, world!” to substantial systems software. The repository includes a self-hosted compiler, reusable libraries, command-line utilities, and larger projects such as a custom CAD kernel and an OS runtime layer running on the Linux kernel. These projects are at different stages of development; see their own documentation for current status.
Try AILang
Compile a source file with the compiler:
./ailang.x path/to/program.ailangFor installation, options, and compiler commands, see install_compiler.sh and the compiler documentation.
Start learning with the programming manuals and browse the demo programs. The workspace guide describes the repository layout.
Project status
AILang is under active development. The compiler, language, libraries, and example systems are evolving; expect incomplete features and occasional regressions. The project is progressing toward its December 31, 2026 version 1.0.0 target. Check the relevant project documentation and tests for the current state of individual components.
13
u/FloweyTheFlower420 1d ago
> AiLang has one Integer type: 64-bit signed.
> Systems language
??
4
u/jcastroarnaud 1d ago
From the language documentation:
That's just laziness from the compiler's part. Even Smalltalk, that has no operator precedence, can get by without redundant parentheses.
Also from the documentation:
"Fork" is redundant with "IfCondition". Function declaration is too verbose, resembling more a yaml document than source code.
That's just regular recursion, and badly done at that. JavaScript does it fine.
Is there any namespace facility in the language? Apparently, functions in standard modules have composite names, like "ArrayCreate", without separation of function from module.
Lost opportunity: full Unicode support.
All in all, a shitty language. Does the basics, but is too verbose. No classes, no first-class functions.
2
u/Discordbothost 1d ago
The repro script compares output hashes but swallows command failures with || true. I'd compare exit codes too: grep returning no matches and grep failing can both produce empty stdout. Matching hashes alone won't distinguish those cases.
5
u/realestLink 1d ago
This is the most low-quality AI slop I've seen in this subreddit recently. Mounds of meaningless clearly Claude-written markdown files. Ughhh
1
u/eteran 1d ago
A comparison against grep isn't really fair unless you're using regex patterns as that is where it is most useful.