π Getting Started with SalamΒΆ
What is Salam?ΒΆ
Salam (Ψ³ΩΨ§Ω β peace) is a statically typed, compiled, general-purpose systems programming language designed to be efficient, readable, and inclusive.
Write code in English, Persian (ΩΨ§Ψ±Ψ³Ϋ), or Arabic (Ψ§ΩΨΉΨ±Ψ¨ΩΨ©).
The general language transpiles to C and compiles to a native executable.
A built-in layout DSL compiles
.salamfiles directly to HTML, CSS, and JavaScript.Runs in the browser via the web playground.
β PrerequisitesΒΆ
| Requirement | Notes |
|---|---|
| A C compiler | tcc (bundled, fast), gcc, or clang |
| CMake β₯ 3.15 | Optional β needed for the CMake build and test suite |
| Git | To clone the repository |
No other runtime or library is required. salam build inlines a small C runtime into every generated file, so programs link only -lm.
π¨ Build the compilerΒΆ
The compiler source lives in compiler/. All build commands are run from that directory.
cd compilerQuick build (tcc)ΒΆ
sh tools/bash/build-compiler.sh # produces ./salamThe salam binary is also copied to the repository root.
CMake build (with tests)ΒΆ
cmake -B build
cmake --build build
ctest --test-dir build # run the test suiteMakefile buildΒΆ
make # release build -> ../salam at the repo rootπ Hello, World!ΒΆ
Save the following to hello.salam:
func main {
println("Hello, World!")
}Compile and run:
salam build hello.salam --output=hello
./helloExpected output:
Hello, World!ποΈ Compiling a program with salam buildΒΆ
# compile to a native executable
salam build app.salam --output=app
# keep the generated C source for inspection
salam build app.salam --keep-c
# compile to an object file only
salam obj app.salam
# pass a preprocessor define
salam build app.salam -DDEBUGMore examples live in examples/en/.
π¨ Formatting with salam fmtΒΆ
salam fmt rewrites source files in place to canonical style.
# format a single file
salam fmt app.salam
# format every .salam file under the current directory, recursively
salam fmt
# check formatting without modifying files (exits 1 if any file needs changes)
salam fmt --check
# format with 2-space indentation
salam fmt app.salam --indent=2
# format with tabs
salam fmt app.salam --tabs
# format a Persian-language source file
salam fmt app.salam --lang=faπ Layout DSL β compile to HTML/CSS/JSΒΆ
Salam includes a built-in DSL for describing web layouts.
# compile a layout file to page.html + page.css + page.js
salam layout build page.salam
# produce a single self-contained HTML file
salam layout build page.salam --inline
# compile multiple pages (merged style.css / script.js)
salam layout build a.salam b.salamπ₯οΈ Interactive REPLsΒΆ
salam cli # general-language REPL
salam layout # layout DSL REPLπ Where to go nextΒΆ
| Resource | Description |
|---|---|
| Web Playground | Try Salam in your browser β no install needed |
| Examples | Ready-to-run programs covering basics, types, stdlib, and more |
| Editor README | How the WebAssembly playground is built and served |
| Platform & word-size support | 32-bit vs 64-bit, C backend vs LLVM backend, release matrix |
| Contributing Guide | How to fork, branch, build, and open a pull request |
| Code of Conduct | Community standards |
| VS Code extension | Syntax highlighting and language support for VS Code |
| Discord | Real-time community chat |
| Telegram | Community on Telegram |