SultanC - an Arabic-first systems programming language
A self-hosted systems programming language, written in Arabic.
Install ยท Language ยท Standard library ยท Targets ยท Documentation
SultanC is a native systems language with ownership-aware safety, algebraic data types, pattern matching and threads. Its keywords exist in Arabic and English as equal, interchangeable surfaces of the same syntax.
The compiler is written in SultanC and compiles itself: every build passes a byte-for-byte self-host check (Stage3 == Stage4).
| English | ุงูุนุฑุจูุฉ |
|---|---|
Same AST, same semantics, same diagnostics: only the keywords and identifiers change.
git clone https://github.com/sultan-language/sultanc.git && cd sultanc
./build.sh # C Stage0 -> Stage1 -> Stage2 (needs LLVM)
sudo cp build/sultanc /usr/local/bin/sultanc
Build Routes
| Route | Command | Needs |
|---|---|---|
| C bootstrap (default) | ./build.sh |
C compiler + LLVM |
| WebAssembly seed | ./build.sh --bootstrap=wasm |
only a C compiler |
| Rebuild from an existing compiler | ./build.sh --bootstrap=existing |
a built build/sultanc (about a minute) |
| With the LLVM backend inside | ./build.sh --enable-llvm |
LLVM 19-23 |
| Self-host check | ./build.sh verify |
Stage3 == Stage4, byte for byte |
macOS with Homebrew LLVM: export LLVM_CONFIG="$(brew --prefix llvm)/bin/llvm-config" before building.
Windows:./build.sh --bootstrap=c --enable-llvm --backend=llvm . sultanc main.sn -o app && ./app
Features
- Ownership, borrowing and move checking, verified statically before code generation
- Algebraic data types and pattern matching, with exhaustiveness checking
- Generics and compile-time evaluation (
ููุช_ุงูุชุฑุฌู ุฉ) - Errors as values:
ูุชูุฌุฉresults,ุpropagation,ุฅูููุงุฑ/panic - Threads and synchronization: spawn/join, atomics,
Arc,Mutex,Condvar,Once, channels, with a compile-time check on what a thread may capture - Arabic and English as equal source surfaces, including every diagnostic
- A verified intermediate representation (MSIR): every pass goes through a checker before reaching a backend
- Native output: ELF, Mach-O, PE/COFF and WebAssembly, with the compiler's own linkers; no libc needed on Linux and FreeBSD
sultanc check main.sn # type-check only
sultanc run main.sn # run in the interpreter, no compilation
sultanc --backend=llvm main.sn -o app # LLVM backend (O2)
sultanc --target=aarch64-linux-gnu main.sn # cross-compile
sultanc --lang=en check main.sn # English diagnostics (Arabic by default)
sultanc --diagnostic-format=json check main.sn
sultanc targets # list every target
The interpreter runs the same MSIR and the same standard library as the compiler, on Linux, macOS, Windows and FreeBSD.
Standard Library
| Area | Highlights |
|---|---|
| Text and formatting | UTF-8 text, Unicode segmentation and normalization, std.fmt (Rust-style format strings, checked at compile time) |
| Collections | vectors with capacity, maps, sets, sorting |
| Files and processes | files, directories, links, file locks, streaming child processes, environment |
| Networking | TCP, UDP, Unix sockets, DNS, TLS 1.3, HTTP/1.1 and HTTP/2 (client and server) |
| Data formats | JSON, TOML, CSV, zip, tar |
| Compression | gzip/deflate, zstd, xz/LZMA2 |
| Crypto and hashing | SHA-2, X25519, Ed25519, ChaCha20-Poly1305, AES-GCM, XXH64, CRC |
| Concurrency | std.thread , std.sync (atomics, Arc, Mutex, RwLock, Condvar, Once, channels) |
See std coverage for the full list, compared with Rust and Go.
Targets
| OS | Architectures |
|---|---|
| Linux | x86_64, aarch64, riscv64, loongarch64, ppc64le, s390x, mips64el, sparcv9, i686, armv7 |
| macOS | arm64, x86_64 |
| Windows | x64, arm64 |
| FreeBSD | x86_64, aarch64, riscv64 |
| Android | x86_64, aarch64, armv7 |
| WebAssembly | WASI (wasm32); freestanding wasm32/wasm64 |
Native backends for x86_64 and arm64; every other target goes through LLVM. See targets.
Documentation
| Architecture & MSIR | How source becomes native code |
| Kernel architecture | Compiler internals |
| Bootstrap | The C Stage0 and the WebAssembly seed |
| Safety flow | Ownership and borrow checking |
| Type system | Types, inference, generics, casts |
| Ownership and destruction | Moves, drops, temporaries, capacity |
| Errors | Results, ุ , panics, localized messages |
| Concurrency | Threads, atomics, synchronization |
| Formatting | std.fmt |
| Interpreter | sultanc run |
| Platform dependencies | What std needs from each OS |
| Arabic terminology | Canonical Arabic compiler vocabulary |
| Examples ยท Tests | examples/ and the test runner |
Self-hosting on x86_64-linux and arm64-darwin , verified by byte-identical convergence across compiler generations, from the C Stage0 and from the WebAssembly seed.
CI builds every route on Linux, macOS and Windows (x64 and arm64).
Comments
No comments yet. Start the discussion.