Skip to content

soplangorg/soplang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

414 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Soplang

The Somali Programming Language

Soplang is a programming language with syntax inspired by Somali, making programming more accessible to Somali speakers. It combines static and dynamic typing in one language with a focus on clarity and ease of use.

The implementation is in Rust. Soplang runs through a compiled pipeline: Cranelift JIT for run and an AOT build path for standalone binaries. See COMPILER_PLAN.md.

Project structure

Path Description
src/ Rust implementation: lexer, parser, semantic, HIR, runtime, Cranelift JIT, and AOT build backend.
examples/ Soplang example programs (.sop files).
benchmarks/ Compiler benchmark programs, RESULTS.md, README, and run_benchmarks.sh to regenerate results.
legacy-interpreter/ Legacy interpreter code, now in the separate repo soplang/soplang-interpreter.
docs/ Documentation (installation, language reference, contributing).
windows/, linux/, macos/ Platform-specific build and packaging scripts.

Features

  • Dual type system — Static typing (abn, qoraal, etc.) and dynamic typing (door)
  • Somali-based syntax — Keywords and concepts in Somali
  • Modern paradigms — Functional, procedural, and object-oriented support
  • Interactive shell — REPL powered by the compiled JIT pipeline
  • Compiled execution — Cranelift JIT for running files, AOT build for standalone binaries

Example

qor("Salaan, Adduunka!")   // Hello, World!

door magac = "Sharafdin"
abn age = 25

hawl salaam(qof) {
    celi "Salaan, " + qof + "!"
}
qor(salaam(magac))

Running Soplang

Build and run:

cargo build --release

./target/release/soplang examples/hello.sop        # JIT run
./target/release/soplang -i    # REPL
./target/release/soplang -c 'qor("Salaan!")'
./target/release/soplang --build examples/hello.sop -o hello_aot
./hello_aot

Or: make build, make run FILE=examples/hello.sop, make shell, make test, make bench.

CLI notes

  • soplang <file.sop>: run via Cranelift JIT.
  • soplang --build <file.sop> -o <out>: build a standalone native binary.
  • soplang --build ... --opt-level 0..3: tune AOT optimization level.
  • soplang --strict: enable stricter static typing checks.

AOT backend note

Current AOT backend is implemented by generating a temporary Rust runner and compiling it to a native executable. This is the supported strategy for now; it can be replaced later with a direct LLVM IR (inkwell) backend.

Benchmark results

The compiler (Cranelift JIT) is benchmarked with Criterion. Summary (release build, in-process):

Benchmark Mean time
fib(25) recursive ~25.6 ms
loop sum 1..100k ~9.9 ms
nested loops 200×200 ~4.2 ms
string concat 1k ~0.67 ms
list ops 5k elements ~1.3 ms
object create 2k ~252 µs

How to run: cargo bench or bash benchmarks/run_benchmarks.sh (regenerates RESULTS.md).
Details: benchmarks/RESULTS.md. Benchmark names and performance notes: benchmarks/README.md.

Legacy interpreter

The legacy tree‑walking interpreter has been moved to a dedicated repository:

All new development (compiler, JIT, AOT, CLI) happens here in the Rust implementation.

Documentation

License

This project is licensed under the MIT License.

About

The Somali Programming Language.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors