Skip to content
SalamLangPublic

Latest commit

Β 

History

7,897 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

The Salam Programming Language - Ψ²Ψ¨Ψ§Ω† Ψ¨Ψ±Ω†Ψ§Ω…Ω‡ Ω†ΩˆΫŒΨ³ΫŒ Ψ³Ω„Ψ§Ω…

Salam Programming Language

Salam is a general-purpose and systems programming language designed for efficient software development, featuring a built-in domain-specific language (DSL)

Discord GitHub Release GitHub repository size

Website Website Salam Programming Language Playground

SalamLang/Salam | Trendshift


Compiler - Build & Release Editor - Playground (WebAssembly) Dependabot Updates GitHub Pages Build Deployment VS Code Marketplace Version VS Code Marketplace Installs


✨ Introducing Salam

Salam Language, inspired by the word salam (Ψ³Ω„Ψ§Ω…), meaning peace, is engineered for exceptional efficiency, reliability, and modern software development. Designed from the ground up to balance low-level control with developer productivity, Salam eliminates the unnecessary syntactic friction often found in systems engineering. By prioritizing a clean, scannable, and intuitive architecture, it lowers the cognitive barrier to entry, fostering an accessible and inclusive environment for building high-performance software.

Supported Languages

  • English: Fully supported and ready for use.
  • Persian (فارسی): Fully supported and ready for use.

Why Choose Salam?

  • 🌍 Localized for Persian Speakers: Write and read code in your native language.
  • πŸ§‘β€πŸŽ“ Beginner-Friendly: Salam makes programming approachable for everyone, including students and new developers.
  • πŸ’» Powerful Tools: Easy to use, but with robust capabilities for all your coding needs.

Key Features

  • ✏️ Intuitive scripting and code compilation.
  • πŸš€ Docker support for seamless development.
  • πŸ”§ Linting and code checks for best practices.
  • πŸ”„ Built-in commands for versioning and updates.

Quick Installing

GNU-Linux/Mac:

{ curl -fsSL https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.sh || wget -qO- https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.sh; } | sh

The installer detects your OS and architecture and adds Salam to your PATH; open a new terminal afterwards.

Options go after sh -s --, for example ... | sh -s -- --dir ./bin --version 0.7.1. The shell installer takes --dir DIR, --version X.Y.Z, --os NAME, --arch NAME, --platform NAME, --no-modify-path, --no-color and --help; run it with --help for the full list.

Downloads from Iran and other restricted networks. Where github.com or release-assets.githubusercontent.com time out, nothing needs to be configured: the installers, salam upgrade and salam upgrade-std try the mirror at https://cdn.salamlang.ir/releases/ first (about 8 seconds to connect, no long stall) and fall back to the same file on GitHub on any failure: a timeout, DNS, TLS, a missing file, or a wrong size or checksum. The mirror copies GitHub's names, so https://github.com/SalamLang/Salam/releases/download/<tag>/<asset> is https://cdn.salamlang.ir/releases/<tag>/<asset>, the newest release is the one line in https://cdn.salamlang.ir/releases/latest, and releases/index.json lists tags, assets, sizes and sha256 values. The mirror is served by the Salam project, not by GitHub; the trust model is HTTPS plus the published .sha256 file beside every asset (the installers reject a mirror copy that does not match it and fetch from GitHub instead). New releases reach the mirror within about 15 minutes. SALAM_NO_CDN=1 turns the mirror off and SALAM_CDN=https://other.example points at another one (only https is accepted, never plain http; an empty SALAM_CDN also turns it off; on Windows use SALAM_CDN=off). Not mirrored: Linux distribution and package-manager channels, salam add / salam install packages from other repositories (those come from their own hosts), and the installer script itself on the first line above, which is fetched from raw.githubusercontent.com. Where that is blocked too, fetch https://cdn.salamlang.ir/install.sh (or install.ps1) instead.

Windows (PowerShell):

irm https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.ps1 | iex

Got Could not create SSL/TLS secure channel? That's PowerShell's default protocol list missing TLS 1.2, common on older Windows Server builds. Enable it for the session first, then retry:

[Net.ServicePointManager]::SecurityProtocol = 3072 -bor [Net.ServicePointManager]::SecurityProtocol
irm https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.ps1 | iex

Still failing? Skip PowerShell entirely and use the cmd.exe installer below - it goes through Windows' own curl.exe/certutil, which negotiate TLS independently of .NET.

To pass options, wrap the fetched script instead of piping it - a bare irm ... 0.7.1 | iex does not work, since that "0.7.1" is parsed as an argument to Invoke-RestMethod, not to the installer:

iex "& { $(irm https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.ps1) } --dir C:\Tools\Salam --version 0.7.1"

Or set the matching environment variable before the plain piped form instead:

$env:SALAM_VERSION = "0.7.1"; irm https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.ps1 | iex

Or from cmd.exe:

curl -fsSLo "%TEMP%\salam-install.bat" https://raw.githubusercontent.com/SalamLang/Salam/refs/heads/main/install.bat && "%TEMP%\salam-install.bat" --version 0.7.1

🧩 Editor Support

Install the official Salam Language extension from the Visual Studio Code Marketplace for syntax highlighting and language support.

Install on VS Code

Everything else

extensions/ has integrations for eleven editors, each with its own installation instructions:

VS Code Vim & Neovim Sublime Text
Emacs JetBrains IDEs Kate & KDevelop
Geany gedit & GNOME Notepad++
GNU nano micro

All of them highlight the English and Persian keyword packs, and the word lists are generated from the compiler's own tables so they cannot drift. The richer plugins also run, build, check and format through the compiler.

πŸš‡ Built with Salam

Salam Tunnel is a desktop app written entirely in Salam. It routes a whole computer through an SSH server with one button, and draws its window with the page language. It is a larger example of native UI, background work, processes and the std/net packages.

πŸ› οΈ The Compiler (salam)

Salam is statically typed and compiled. It has five generators, each one a different way to run the same general language. Four of them produce a native executable or another target, and the fifth runs the program directly. Embedded page: blocks compile to HTML/CSS/JS.

Generator Flag or command How it works
LLVM --backend=llvm, salam llvm --jit LLVM IR, optimized and linked in-process when the compiler has LLVM linked in. --jit runs that IR at once through lli, with no artifact
C --backend=c C source handed to a C compiler (the first of clang, gcc, tcc or cc it finds, a bundled one before the system one, or any --cc=PATH)
Native --backend=native the compiler's own code generator writes the machine code and the object file, and its own linker links them (see below)
JavaScript salam build --platform=js browser-ready JavaScript, or one self-contained .html page when the output name ends in .html
Interpreter salam exec, salam run --interp a bytecode VM with a garbage collector, no C toolchain needed; SALAM_VM=0 uses the older tree walker

With no --backend, the compiler uses the native backend on a Windows on Arm host, LLVM when it has LLVM linked in (the release builds for Linux, macOS and Windows x86-64 do), and the C backend otherwise. --cc=PATH implies the C backend.

Salam is implemented in Salam. The compiler, the standard library and the tooling are written in Salam and built by Salam itself, so Salam is designed, implemented and powered by Salam.

Build

The compiler is written in Salam and lives in compiler/, with the standard library in std/. Building it needs an existing salam (a release from the installer above is enough) as the seed:

sh tools/bash/build-selfhost.sh                    # seed: the salam on PATH  ->  ./salam
sh tools/bash/build-selfhost.sh --seed=/path/to/salam --output=/tmp/salam
sh compiler/tools/bash/bootstrap.sh "$(command -v salam)"   # three stages and a fixpoint check, in build/selfhost

build-selfhost.sh writes salam into the current directory and points the build at this checkout's std/. The result has no LLVM linked in, so it defaults to the C backend. To link LLVM in, build libsalam_llvm.a with std/llvm/native/build.sh and pass its directory as --llvm=DIR; .github/workflows/compiler-release.yml has the full release recipe, sysroots included.

Usage

# general language -> native executable
salam build app.salam                          # -> app (app.exe on Windows)
salam build app.salam --output=myapp           # then ./myapp
salam run app.salam                            # build and run, keep nothing
salam run app.salam -- one two                 # arguments after -- go to the program
salam exec app.salam                           # run with the interpreter, no C toolchain
salam build app.salam --backend=c --emit-c     # write the generated C and stop
salam obj app.salam                            # compile to an object file only

# type-check without building (exit 1 on errors; --error-format=json for tools)
salam check app.salam

# run the tests (*_test.salam files, test_ functions)
salam test

# inspect any stage (general or page)
salam inspect app.salam --emit-tokens | --emit-ast | --emit-symbol
salam inspect app.salam --log-level=trace
salam build app.salam -DDEBUG                  # conditional-compilation flag

# format source in place
salam format app.salam                         # reformat one file
salam format                                   # reformat every .salam under the cwd, recursively
salam format compiler/ tests/                  # reformat given files and/or directories
salam format --check                           # report files that need formatting (exit 1 if any)
salam format app.salam --tabs                  # indent with tabs (convert spaces to tabs)
salam format compiler/ --indent=2              # indent with 2 spaces per level
salam format page.salam --lang=fa              # Persian source

# REPLs
salam cli       # general
salam page      # page DSL

salam help lists every command and option.

Hello, World:

func main:
    println "Hello, World!"
end

New projects

salam new NAME makes a folder with main.salam, salam.toml and a .gitignore; salam new NAME --desktop makes a desktop app with a web interface (see docs/DESKTOP.md). salam init [DIR] writes a project into DIR (the current folder by default) when it is empty; .git, .gitignore, .DS_Store, README* and LICENSE* (the last two in any letter case) do not count, and an existing file is kept. When it holds any other file or folder, the project goes into a new subfolder named after the project. In a terminal init asks for the name, a description, the type (cli, http or dsl, the page language), the platforms, the design system (shadcn or none) and the web mode (page, spa or ssr), shows a summary and writes a starter project with a readme; the answers go into [project] and [design] in salam.toml. The flags --name=, --description=, --type=, --platforms=a,b|all, --design= and --web= answer questions up front, and -y accepts the defaults, so scripts never wait for input. --lang=fa writes a Persian project.

salam new hello                                # hello/main.salam, hello/salam.toml
cd hello && salam run
salam init -y --type=dsl --platforms=web,linux # a page project in the current folder

Building for web, mobile and desktop

One page: program targets every platform. salam build and salam run take --platform=web|js|android|ios|linux|macos|windows, and salam build also --platform=all for every platform a project lists in salam.toml. --arch=x86_64|aarch64|i686|arm|riscv64 picks the CPU for Linux, macOS and windows; --target=TRIPLE spells the whole target out and wins over both.

salam build page.salam --platform=web          # page.html (+ page.css/.js when needed)
salam build page.salam --platform=web --inline # one self-contained page.html
salam build . --platform=web                   # every page in the folder, one shared style.css
salam run --platform=web                       # serve the project, reload the browser on every save
salam build app.salam --platform=js            # app.js (app.html with -o app.html)
salam build --platform=android                 # build/android (needs the Android SDK, NDK and a JDK)
salam build --platform=ios                     # build/ios (needs a Mac with Xcode)
salam build --platform=linux --arch=aarch64    # static Linux executable for another CPU
salam run --platform=macos                     # on a Mac: open a page project in a native window
salam build --platform=all                     # every platform listed in salam.toml

With no --platform, a project made by salam init --type=dsl builds the first platform it lists, and salam run serves web when it is listed. The old commands salam js, salam web, salam page build and salam app are gone. Options for the Android and iOS app builder go after --, for example salam build --platform=android app.salam -o out -- --abi x86_64. See docs/MOBILE.md, docs/DESKTOP.md and docs/GETTING_STARTED.md. The defaults for the design, the installers, the Windows executable and the phone apps live in salam.toml; every key is listed in docs/PROJECT_FILE.md.

Packages

The standard library ships with the compiler (import net.http, import encoding.json) and needs no install. Other packages are GitHub repositories recorded in salam.toml and salam.lock:

salam search json                              # standard library and registry
salam add github.com/owner/repo                # newest release; or [email protected]
salam update                                   # newest releases with the same major version
salam deps                                     # download and verify what salam.lock lists
salam remove github.com/owner/repo
salam install github.com/owner/repo            # build a program into ~/.salam/bin

See docs/PACKAGES.md. salam upgrade updates the compiler, the standard library and the bundled tools to the newest release.

Editor support

salam lsp is a language server on stdin and stdout (diagnostics, hover, completion, go to definition, rename, formatting and quick fixes); the editor plugins under extensions/ start it, and docs/LSP.md lists what it covers. salam dap is the debug adapter behind F5 in Visual Studio Code.

Cross-compilation

Pass a full target triple with --target=<triple> to build or obj. A --target build goes through the LLVM backend, or through the native backend with --backend=native. The output name follows the target's conventions (.exe for Windows, .obj for MSVC objects, none for ELF), and --output overrides it as usual, except that a Windows target still gets .exe appended to a name that lacks it, so the binary stays launchable there.

# Windows executable from Linux (MinGW target)
salam build main.salam --target=x86_64-w64-windows-gnu --output=app.exe

# static Linux executables for other architectures
salam build main.salam --target=aarch64-linux-musl
salam build main.salam --target=arm-linux-musleabihf

# WebAssembly (WASI)
salam build main.salam --target=wasm32-wasi --output=app.wasm

# a target-specific object file
salam obj main.salam --target=x86_64-pc-windows-msvc      # -> main.obj

The target is fully wired through the pipeline: the OS/arch predefined macros (SALAM_OS_WINDOWS, SALAM_ARCH_X64, …) describe the target, so if SALAM_OS_WINDOWS: selects the right branch, and link dynamic|static| framework "..." directives are passed to the cross-linker (e.g. link dynamic "user32" β†’ -luser32).

Prerequisites. The Linux x86-64 release compiler has LLVM, LLD and sysroots linked in (musl for x86-64, aarch64, i686 and armhf, MinGW-w64 for x86-64 and i686, and wasm32-wasi), so cross-compiling to those targets needs nothing else installed; the Windows x86-64 one also embeds LLVM, LLD and MinGW-w64 and musl sysroots. A compiler without LLVM drives the system toolchain instead: clang/llc 22, lld, and a sysroot (the target's CRT, system import libraries and headers):

sudo apt install clang lld llvm        # toolchain (or an official LLVM release)

Sysroots are found in $SALAM_SYSROOTS, then in a sysroots/ directory next to the compiler or its standard library (or ../share/salam/sysroots, ../lib/salam/sysroots). They are named by toolchain, not by the raw triple: <arch>-w64-mingw32/ for *-windows-gnu (e.g. x86_64-w64-mingw32/) and <arch>-linux-musl/ for *-linux-musl (e.g. x86_64-linux-musl/). tools/bash/stage-sysroots.sh --out=DIR stages them from installed MinGW and musl packages.

MSVC / macOS targets. Automatic sysroot discovery handles MinGW (*-windows-gnu) and musl (*-linux-musl). Microsoft's and Apple's SDKs are not redistributable, so for *-windows-msvc you supply a sysroot yourself (e.g. xwin) and drive clang through salam llvm. On Linux, prefer the -windows-gnu (MinGW) triple. For macOS, --backend=native writes Mach-O for x86_64-apple-macos and arm64-apple-macos and links it with the built-in linker, with or without an SDK; see docs/NATIVE_LINKER.md.

Bare-metal kernels

A *-none or *-salamos* target builds without an operating system: no libc, no crt files and no syscalls. The compiler links its small freestanding runtime and accepts a boot stub and a linker script:

salam build kernel.salam --target=i686-unknown-none \
    --entry=_start --linker-script=linker.ld \
    --link-object=boot.o --output=kernel.elf

println still works through COM1, the VGA text buffer and the QEMU debug console, and std/baremetal adds port I/O, Halt, Panic, direct VGA writes and a heap. tests/kernel/ is a complete bootable Multiboot example; see docs/FREESTANDING.md.

Native code generator and linker

--backend=native compiles straight to machine code and writes the object file itself (ELF, COFF or Mach-O), with no assembler, C compiler or LLVM library involved. Salam's own native linker then produces the executable, so the generator and the linker are both part of Salam. It targets x86-64, i686, AArch64, 32-bit ARM and RISC-V 64 on Linux, x86-64, i686 and AArch64 on Windows, and x86-64 and arm64 on macOS. By default (--linker=auto) the compiler's own linker links the result whenever it can find every input; --linker=system hands the link to cc or the MinGW gcc instead.

salam build main.salam --backend=native
salam build main.salam --backend=native --target=x86_64-w64-windows-gnu
salam build main.salam --backend=native --target=aarch64-linux-musl
salam build main.salam --backend=native --emit-asm    # also writes main.s

It shares llvmgen's lowering with the LLVM backend, so it covers the whole language and standard library, and it has its own optimizer (inlining, SROA, mem2reg, constant folding, jump threading, linear-scan register allocation). It is the default backend on Windows on Arm, where neither LLVM nor tcc ship. See docs/NATIVE_BACKEND.md for how it works and how to test it, and docs/NATIVE_LINKER.md for the linker.

docker/ builds the runtime image published on Docker Hub as basemax/salam, for linux/amd64, linux/arm64, linux/arm/v7 and linux/386. It is Debian trixie-slim with a released compiler bundle (salam plus std/, installed by docker/install.sh under /opt/salam) and tcc with the libc headers for the C backend. salam is the entrypoint and /work the working directory:

docker run --rm -v "$PWD":/work basemax/salam build app.salam --output=app
docker run --rm -v "$PWD":/work basemax/salam run app.salam

To build the image yourself:

docker build -t salam docker                                   # newest release
docker build -t salam --build-arg SALAM_VERSION=0.7.1 docker   # a chosen release

docker/docker-compose.yml builds the same image and mounts the repository root at /work, so the shared tests/ are reachable:

docker compose -f docker/docker-compose.yml run --rm salam build tests/en/basics/hello.salam --output=hello
docker compose -f docker/docker-compose.yml run --rm salam build page.salam --platform=web --inline

The image runs a released compiler, not the one in your checkout. To rebuild ./salam from your checkout on every change, run tools/bash/docker-dev.sh on the host: it needs entr and a seed salam, watches compiler/ and std/, and reruns tools/bash/build-selfhost.sh.

Books (XeLaTeX)

The tutorial books have their own image under books/docker/ so you can typeset them without installing a local TeX distribution. One common XeLaTeX image builds both languages: it is based on the full TeX Live scheme, which already bundles xepersian (for the heavier right-to-left Persian book), polyglossia + tcolorbox (for the lighter English book) and Latin Modern. The books/ tree is bind-mounted, so the generated PDFs are written back to the host at books/<lang>/intro-programming/book.pdf:

docker compose -f books/docker/docker-compose.yml run --rm books        # both
docker compose -f books/docker/docker-compose.yml run --rm books en     # English only
docker compose -f books/docker/docker-compose.yml run --rm books fa     # Persian only

Or with plain Docker (build once, then run against the mounted books/ tree):

docker build -t salam-books books/docker
docker run --rm -v "$PWD/books":/books salam-books all

πŸš€ Bun Workspaces: Multi-App Development & Static Site Guide

πŸš€ 1. Quickstart Execution Guide

To kick off your entire localized monorepo environment simultaneously, run the following steps from your root directory.

  • Install workspace links and cached instances:
bun install
  • Boot up all servers concurrently:
bun run dev:all

Your terminal window will display interleaved logs, cleanly prefixed by their respective package origins:

Salam % bun run dev:all
$ bun run --filter='*' --parallel dev
@workspace/editor:dev        |
@workspace/editor:dev        |   VITE v8.1.3  ready in 65 ms
@workspace/editor:dev        |
@workspace/editor:dev        |   ➜  Local:   http://127.0.0.1:55001/
@workspace/runner:dev        |
@workspace/runner:dev        |  ⛅️ wrangler 4.107.0
@workspace/runner:dev        | ────────────────────
@workspace/runner:dev        | βŽ” Starting local server...
@workspace/runner:dev        | [wrangler:info] Ready on http://localhost:8787
@workspace/runner:dev        | [wrangler:info] GET / 200 OK (7ms)

πŸ“ 2. Monorepo Architecture & Core Setup

To configure the workspace, structure your repository directory tree alphabetically as follows:

salam-monorepo/
β”œβ”€β”€ bunfig.toml
β”œβ”€β”€ package.json
β”œβ”€β”€ editor/
β”œβ”€β”€ extensions/
β”‚   └── vscode/
└── runner/

Root Configuration Files

package.json (Workspace Root)

This file defines the workspaces in strict alphabetical order and leverages Bun's parallel filtering mechanics. It also centralizes shared dependency versions via Bun's workspace catalog and exposes root scripts for local development, builds, Wrangler type generation, and dependency updates.

{
  "name": "salam-monorepo",
  "private": true,
  "workspaces": {
    "packages": [
      "editor",
      "extensions/vscode",
      "runner"
    ],
    "catalog": {
      "react": "^19.2.7",
      "react-dom": "^19.2.7",
      "tailwindcss": "^4.3.2",
      "@tailwindcss/vite": "^4.3.2",
      "@vitejs/plugin-react": "^6.0.3",
      "vite": "^8.1.3",
      "typescript": "^6.0.3",
      "wrangler": "^4.107.0",
      "@types/bun": "latest",
      "@types/node": "^26.1.0",
      "@types/react": "^19.2.17",
      "@types/react-dom": "^19.2.3"
    }
  },
  "scripts": {
    "dev:all": "bun run --filter='*' --parallel --if-present dev",
    "dev:editor": "bun run --filter='@workspace/editor' dev",
    "docs:myst": "bun run myst start",
    "dev:runner": "bun run --filter='@workspace/runner' dev",
    "build:all": "bun run --filter='*' --if-present build",
    "build:myst": "bun run myst build --html",
    "update:deps": "bun update -i -r",
    "clean": "rm -rf node_modules **/node_modules .bun-cache",
    "generate": "bun run --filter='@workspace/runner' generate",
    "typecheck": "bun run --filter='@workspace/runner' typecheck"
  },
  "devDependencies": {
    "@biomejs/biome": "^2.5.6",
    "@tailwindcss/vite": "catalog:",
    "@vitejs/plugin-react": "catalog:",
    "mystmd": "^1.10.1",
    "vite": "catalog:"
  }
}

Useful root commands:

  • bun run dev:all: start every workspace that exposes a dev script
  • bun run dev:editor and bun run dev:runner: start one workspace at a time
  • bun run build:all: run every workspace build script that exists
  • bun run docs:myst: start the MyST documentation dev server
  • bun run build:myst: build the MyST documentation to static HTML (_build/html/)
  • bun run generate: refresh Cloudflare Wrangler types for runner/
  • bun run typecheck: regenerate Wrangler types and run the runner/ TypeScript check
  • bun run update:deps: interactively update dependencies across the workspace
bunfig.toml (Workspace Root)

Forces Bun to persistently treat execution environments with development-first behaviors.

[development]
development = true

πŸ”„ 3. Global Monorepo Package Updates

To manage and upgrade your external dependencies across all application subdirectories together without navigating into individual package folders, trigger your custom root shortcut:

bun run update:deps

Explaining the Flags Behind the Script (bun update -i -r)

  • -i (--interactive): Spawns an interactive Terminal User Interface (TUI) mapping out all out-of-date assets. Use your Arrow keys and spacebar to selectively pick packages to upgrade, or toggle l to force a package beyond its defined SemVer range to its absolute --latest release.
  • -r (--recursive): Forces Bun's resolution engine to sweep across all items listed under your workspaces field (editor, runner, etc.) instead of executing purely inside the main directory.

When initialized, Bun appends a Workspace column to your terminal output grid so you can verify exactly where every target module upgrade is bound before writing the changes to disk.


πŸ“š 4. MyST Documentation

The repository ships a MyST (Markedly Structured Text) docs site powered by mystmd. Source content comes from books/ (TeX book files) and .md files across the repository.

Configuration Files

  • myst.yml - MyST project config (site template, repository link, and custom style file).
  • .readthedocs.yaml - Read the Docs build config used to host the generated documentation.
  • _build/ - generated static output directory from myst build --html (including _build/html/), ignored by Git in .gitignore.

Running the Documentation Locally

# Install workspace dependencies (includes mystmd)
bun install

# Start the live-reload docs server
bun run docs:myst

# Build the static HTML output to _build/html/
bun run build:myst

The dev server (myst start) watches books/ and .md files across the repository and rebuilds on changes. Read the Docs uses .readthedocs.yaml to autobuild and deploy the site.

🀝 Contributing

We welcome contributions from the community!

Together, let’s make coding accessible to all.


πŸ” Joining Code Reviews

Everyone is welcome, and encouraged, to participate in code reviews. You do not need to be a core maintainer to review a pull request. In fact, reviewing PRs is one of the most impactful ways to contribute to Salam, and we want to make it as approachable as possible.

πŸ’‘ Code review is harder than writing code. Reading someone else's work, understanding their intent, spotting edge cases, and communicating feedback kindly and clearly takes real skill. If you are doing it, thank you; it matters enormously.

How a GitHub PR Review Works

Open any pull request, then click the Files changed tab to see a diff of every file that was modified.

Leaving an inline comment

  1. Hover over any line number in the diff; a blue + button appears.
  2. Click it to open a comment box for that specific line or block.
  3. Write your thought, then click Start a review (not "Add single comment") so all your notes are batched together.

Suggesting a code change

Inside an inline comment you can propose an exact replacement using a fenced suggestion block:

```suggestion
your replacement code here
```

The author can accept your suggestion with a single click, no manual editing required.

Submitting the review

When you have finished reading all the files:

  1. Click the green Review changes button (top right of the diff).
  2. Write an overall summary comment.
  3. Choose one of three outcomes:
    • πŸ’¬ Comment - share thoughts without formally approving or blocking. Great for questions, first-timer feedback, or discussion starters.
    • βœ… Approve - you are satisfied with the changes. This is the green tick that moves a PR toward merging. Only approve if you have read the changes carefully.
    • 🚫 Request changes - something needs to be fixed before the PR can merge. Be specific and constructive.
  4. Click Submit review.

Tips for great reviews

  • A simple comment is perfectly fine. If you are new to reviewing, just leaving a thoughtful question or noting something you learned is genuinely valuable. You don't have to approve or block.
  • Be kind and specific. Point to the exact line, explain why something may be a concern, and suggest an alternative when you can.
  • Assume good intent. The author put effort into this. Phrase feedback as questions ("Could this be…?") rather than commands ("Change this to…").
  • First-timer PRs deserve extra warmth. If a contributor's bio or commit history shows they are new, a short encouraging note goes a long way.
  • Approve when you mean it. The green checkmark signals trust. Reserve it for changes you have genuinely read and feel confident about.

Growing with the Community

Consistent reviewers and contributors are noticed. Active participation in reviews, issues, and discussions is how community members become trusted collaborators. Over time, standout contributors may be invited to join the Salam core team and take on additional responsibilities:

  • 🏷️ Triage role - help label, categorise, and prioritise incoming issues and pull requests.
  • πŸ›‘οΈ Discord / Telegram moderator - help keep real-time channels welcoming and on-topic.
  • πŸ”‘ Maintainer access - merge PRs, manage releases, and help shape the roadmap.

πŸ’¬ Real-Time Community

The Salam core team lives in our real-time channels. Join us to ask questions, share ideas, discuss reviews in progress, or just say hello:

Platform Link
Discord discord.gg/HfY3QHDPdv
Telegram t.me/SalamProgrammingLanguage

These spaces are open to everyone, from curious newcomers to experienced systems programmers. The more voices the better.


πŸ“– Glossary

Terms used across this readme, the Contributing Guide, and the editor readme.

Term Definition
AST (Abstract Syntax Tree) Tree representation of parsed source code. Each node represents a construct (expression, statement, declaration). The Salam compiler builds an AST before semantic analysis and code generation.
Biome Fast JavaScript/TypeScript linter and formatter. Run as a prek hook (biome-check).
Bun JavaScript runtime, package manager, and bundler. Used in the Salam monorepo to manage workspaces and run dev servers.
C ABI C Application Binary Interface, the low-level contract for how functions are called and data is laid out in memory. Salam's FFI and extern declarations rely on the C ABI.
CI (Continuous Integration) Automated pipeline that builds, tests, and lints every pull request. Salam uses GitHub Actions for CI.
Clang LLVM-based C compiler. One of the C compilers the C backend can use (--cc=clang), and the tool a compiler without LLVM linked in uses for --target builds.
Cloudflare Workers Serverless compute platform that runs JavaScript/TypeScript at the edge. The runner/ workspace deploys to Cloudflare Workers via Wrangler.
Codegen Code-generation backend. Transforms the compiler's AST and type information into target output (C source, LLVM IR, machine code, or JavaScript).
Codespell Spell checker for source code and documentation. Run as a prek hook to catch typos.
defer Salam keyword that schedules a statement or block to run at the end of the enclosing scope, regardless of how the scope is exited.
Docker Container platform. The basemax/salam image runs a released Salam compiler in an isolated, reproducible environment.
Docker Compose Tool for defining and running multi-container Docker applications. Salam provides a docker-compose.yml in docker/ with one salam service that mounts the repository at /work.
doctoc Tool that auto-generates a Table of Contents inside Markdown files. The TOC blocks in this readme and the Contributing Guide are maintained by doctoc.
DSL (Domain-Specific Language) A language tailored to a specific problem domain. Salam includes a built-in layout DSL that compiles .salam files to HTML, CSS, and JavaScript.
Emscripten LLVM-based toolchain that compiles C/C++ to WebAssembly. Used to build salam-wa.wasm and salam-wa.js for the web playground.
entr Utility that re-runs a command whenever watched files change. Used by tools/bash/docker-dev.sh to rebuild the compiler on source edits.
FFI (Foreign Function Interface) Mechanism for calling functions written in another language (typically C). Salam supports FFI via extern declarations.
Fork A personal copy of a repository on GitHub. Contributors fork SalamLang/Salam, work in their fork, then open a pull request back to the original.
GCC GNU Compiler Collection. One of the C compilers the C backend can use (--cc=gcc).
Gitleaks Secret-detection tool run as a prek audit hook to prevent accidental commits of API keys or credentials.
GitHub Actions Salam's CI/CD platform. Workflows are defined in .github/workflows/.
Layout DSL Salam's built-in sublanguage for describing UIs. page: blocks, built with salam build --platform=web, compile to HTML, CSS, and JavaScript, or run in a native window with --ui=native.
Lexer First stage of the compiler pipeline: reads source text and produces a stream of tokens.
LLVM Low Level Virtual Machine, a compiler infrastructure project. Salam's default backend when the compiler has LLVM 22 linked in, as the Linux, macOS and Windows x86-64 releases do.
Markdownlint Linter for Markdown files. Enforces consistent style in README.md, CONTRIBUTING.md, and other docs.
musl A small C standard library. Salam embeds musl sysroots for static Linux cross builds (--target=*-linux-musl), and the linux-x86_64-musl release is a fully static compiler built against it.
MyST (Markedly Structured Text) Documentation toolchain that extends Markdown with roles, directives, and cross-references for technical writing. Configured via myst.yml; driven by the mystmd package (scripts docs:myst and build:myst).
npm Node Package Manager. Used alongside Bun for package management in the Salam monorepo.
Parser Second stage of the compiler pipeline: consumes the token stream from the lexer and builds an AST.
PR (Pull Request) A GitHub mechanism for proposing changes: a contributor opens a PR from a feature branch, reviewers comment, and a maintainer merges it.
prek Git hook manager used by Salam. Hooks are defined in prek.toml (standard and manual stages) and prek-audit.toml (security-focused audit checks).
prek-audit.toml prek configuration file for security-focused audit hooks. Run separately with prek run --all-files --config prek-audit.toml.
Prettier Opinionated code formatter for JavaScript, TypeScript, CSS, and JSON. Run as a prek hook.
React JavaScript library for building user interfaces with a component model. Used in the editor/ workspace.
Read the Docs Free documentation hosting platform. Salam's MyST docs are automatically built and published there via .readthedocs.yaml.
REPL Read-Eval-Print Loop, an interactive session where you type expressions and see results immediately. salam cli starts a general REPL; salam page starts a page REPL.
RTL (Right-to-Left) Text direction used by Arabic and Persian scripts. The Salam web playground supports RTL and switches direction when the Persian language is selected.
Semantic Analyzer Third stage of the compiler pipeline: resolves names, checks types, and validates the AST before code generation.
SemVer (Semantic Versioning) Version numbering scheme (MAJOR.MINOR.PATCH). Used by Bun's interactive update tooling and GitHub releases.
shfmt Shell script formatter. Run as a prek manual-stage hook to normalise indentation and style in .sh files.
Super-Linter GitHub Actions workflow that runs a broad set of language-specific linters across the repository in CI.
Tailwind CSS Utility-first CSS framework. Used in the Salam monorepo workspaces; integrated via the @tailwindcss/vite plugin.
TCC (Tiny C Compiler) Lightweight, fast C compiler. The C backend's default C compiler, bundled with the Windows x86-64 and i686 releases.
Tree-walking interpreter An interpreter that evaluates the AST directly without first compiling to native code. Used by the web playground and via salam exec / salam run --interp for pure-compute programs.
TUI (Terminal User Interface) Interactive, keyboard-driven interface rendered in the terminal. Bun's bun update -i flag opens a TUI for selecting which packages to upgrade.
TypeScript Typed superset of JavaScript that compiles to plain JavaScript. Used in the runner/ workspace.
Upstream The original SalamLang/Salam repository. Contributors add it as a Git remote (git remote add upstream …) to keep their fork in sync.
Virtual filesystem Emscripten's in-browser filesystem layer. build-wasm.sh preloads the std/ directory into it so import resolution and the layout schema work when running Salam in the browser.
Vite Frontend build tool and dev server. Used in the Salam monorepo to serve the editor workspace.
WebAssembly (Wasm) Portable binary instruction format that runs at near-native speed in modern browsers. Salam's web playground is powered by a Wasm build of the compiler produced by Emscripten.
Wrangler Cloudflare's CLI for building and deploying Workers. The runner/ workspace uses Wrangler for local development (wrangler dev) and CI type generation.
yamllint YAML linter. Run as a prek hook to validate .yml workflow and configuration files.

Licence

Salam is licensed under the GNU General Public License v3.0. See LICENSE.

One directory is deliberately excepted:

Path Licence
Everything not listed below GPL-3.0
extensions/vscode/ MIT, see extensions/vscode/LICENSE

The Visual Studio Code extension, and in particular the TextMate grammar it ships at extensions/vscode/syntaxes/salam.tmLanguage.json, is MIT so that other projects can vendor it. Syntax highlighting is only useful if editors, code-hosting sites and documentation tools can embed it, and several will not accept a copyleft grammar. GitHub Linguist, for example, accepts grammar dependencies only under permissive licences.

The files the extension actually publishes are all editor data with no GPL dependency. Its src/ and scripts/ are written in Salam and import the standard library, so they are GPL-derived when built, and .vscodeignore keeps both out of the published .vsix. See extensions/vscode/README.md for the detail.

Keeping the exception inside the monorepo means the grammar stays generated from the compiler's own keyword tables and cannot drift out of step with the language.


Β© 2024-2026 Salam Language Team

Releases

Sponsor this project

Packages

Used by

Contributors

Languages