Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

πŸš€ Getting Started with Salam

πŸš€ 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.

βœ… PrerequisitesΒΆ

RequirementNotes
A C compilertcc (bundled, fast), gcc, or clang
CMake β‰₯ 3.15Optional β€” needed for the CMake build and test suite
GitTo 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 compiler

Quick build (tcc)ΒΆ

sh tools/bash/build-compiler.sh   # produces ./salam

The 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 suite

Makefile 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
./hello

Expected 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 -DDEBUG

More 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ΒΆ

ResourceDescription
Web PlaygroundTry Salam in your browser β€” no install needed
ExamplesReady-to-run programs covering basics, types, stdlib, and more
Editor READMEHow the WebAssembly playground is built and served
Platform & word-size support32-bit vs 64-bit, C backend vs LLVM backend, release matrix
Contributing GuideHow to fork, branch, build, and open a pull request
Code of ConductCommunity standards
VS Code extensionSyntax highlighting and language support for VS Code
DiscordReal-time community chat
TelegramCommunity on Telegram