SultanC:以阿拉伯文為優先的系統程式語言
SultanC – an Arabic-first systems programming language
SultanC 是一款以阿拉伯文撰寫的原生系統程式語言,阿拉伯文與英文關鍵字是同一套語法中可互換的寫法,並提供所有診斷訊息的雙語介面。
- - 語言與安全性:支援所有權與借用檢查、代數資料型別、模式比對、泛型、編譯期求值及執行緒。
- 程式碼產生前會靜態檢查所有權安全,並檢查執行緒可擷取的內容。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
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.
Install
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
| 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 && ./appLanguage
- 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 |
Status
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).