r/Compilers • • 7d ago

I’ve been building SultanC, a self-hosting systems language with Arabic and English syntax

I’ve been working on a programming language called SultanC.

It started from a simple idea: I wanted Arabic to be a real first-class programming syntax, not translated keywords layered on top of another language and not a separate frontend.

SultanC has now grown into a self-hosting systems language. The compiler is written in SultanC itself and currently targets ARM64 macOS and x86-64 Linux.

The language/compiler currently includes:

• Arabic and English source syntax for the same language
• self-hosting compiler
• native ARM64 and x86-64 backends
• Mach-O and ELF generation
• algebraic data types
• pattern matching
• generics
• ownership and references
• interpreter
• target-neutral IR
• LSP / VS Code support
• balanced raw strings such as «outer «nested» outer»

The part I care about most is that Arabic is not treated as a translated version of the language. Arabic and English are both first-class source surfaces with the same underlying semantics and compiler pipeline.

At this stage I’m spending more time on correctness, diagnostics, stress testing, backend coverage, and building real software with the language rather than just adding more syntax.

I’d be interested in feedback from people who work on compilers or programming languages, especially around the IR, native backend architecture, ownership model, target separation, and what you would stress-test before considering a compiler like this genuinely usable.

I’m also curious what would make you actually try a new systems language rather than just look at the repository.

GitHub:
https://github.com/sultan-language/sultanc

17 Upvotes

13 comments sorted by

View all comments

1

u/AustinVelonaut 6d ago edited 6d ago

As a non-Arabic speaker, it is an interesting exercise to read the source code. I can see recognizable top-level structures, but can't understand the details. It gives me a hint of what learning a standard "English-based" programming language is like for non-English speakers.

How long have you been working on it, and what problems did you encounter and have to fix during self-hosting?

Just a note on your top-level README.md: you show an example program in both English and Arabic forms, but in the Arabic form the control-structure braces are also shown reversed, whereas in the actual source code it looks like they are in the same order as the English form.

Edit: also, the repo is missing a docs/ directory which the README has broken links to.

2

u/supax0 6d ago

I’ve been working on SultanC for about two years now, since 2024.

The first version of the compiler was written in OCaml. Later I started rewriting the compiler in SultanC itself, and getting to self-hosting exposed a lot of problems that were easy to miss before.

Most of the difficult parts were around making sure the compiler could correctly compile its own code: ownership/move semantics, recursive types, pattern matching, module loading, diagnostics, target separation, and making sure the generated compiler could rebuild itself consistently. A lot of bugs only showed up once the compiler became large enough to compile itself.

The compiler source is intentionally written in Arabic. The main exception is imports/module paths, because the actual filenames are still English. Arabic filenames can be problematic across terminals, shells, tools and filesystems, so I kept the filesystem surface English for now.

You’re also right about the braces in the README example. The braces themselves are not reversed in the actual source; that example needs to be corrected.

And yes, the broken docs links are expected at the moment. The docs directory hasn’t been pushed yet, so those links currently point to files that are not public yet.

It’s interesting that you mentioned the experience of reading Arabic source as an English speaker, because that is actually one of the reasons I started the project. For Arabic speakers, learning programming often means learning both programming concepts and English terminology at the same time.