Open source, statically typed, bilingual

The Salam programming language

Salam is a general-purpose systems language with one unusual property: every keyword, type, standard library package and error message has both an English and a Persian name, and the two are the same language. Write a program either way and it compiles to the same fast native executable for Linux, macOS, Windows and the web.

No install needed to start: write and run code in the online editor. Latest release: 0.6.2

hero.salam
import encoding.json

func main:
    println "In the name of God"
    repeat 3:
        println "Hello"
    end
    names := ["Ali", "Reza", "Fatemeh", "Erfan"]
    each name in names:
        println name
    end
    println json.Marshal(names)
end
OutputIn the name of God Hello Hello Hello Ali Reza Fatemeh Erfan ["Ali","Reza","Fatemeh","Erfan"]

Why Salam?

Salam aims at the performance of a systems language with the readability of a teaching one.

Two languages, one compiler

Keywords, types, the standard library and every diagnostic exist in English and Persian. This is not a skin over an English language: both spellings go through the same lexer, and salam translate converts a program from one to the other.

Fast and native

Salam compiles through LLVM or C to a native executable. No virtual machine and no garbage collector; the binary is small and runs straight on the operating system.

Statically checked

Types are checked before the program runs, and the compiler rejects the usual quiet mistakes: an unused variable or function, a declaration used before it is defined, an assignment to something declared constant.

The web is part of the language

Salam has a built-in layout language that emits HTML, CSS and JavaScript, and the compiler also targets the browser and WebAssembly.

A standard library that comes with it

More than 150 packages ship with the compiler: strings and files, JSON, HTTP and TLS, cryptography, databases, images, tensors and machine learning.

Tooling in one binary

Formatter, documentation generator, English and Persian translator, debugger, REPL, online editor and plugins for eleven editors, all behind the single salam command.

In the same range as C and Rust, in English or Persian

On 39 identical programs Salam averaged 10.6 ms, C 11.7 ms and Rust 11.3 ms.

56xfaster than Python
9.6xfaster than PHP
10.6 / 11.7ms, Salam / C
1.3xfaster than Go

Built with Salam, from the OS to this very website

Speed is not only a benchmark story. Salam already runs real software.

Over 150,000 users on one small server

Services built with Salam comfortably serve more than 150,000 users, and do it on a single small server.

A whole operating system in Salam

An operating system has been written entirely in Salam, so the language is ready for the lowest layers of a software stack.

Salam is written in Salam

The compiler is written in Salam and nothing else: more than 200 Salam source files that compile Salam.

This website is Salam too

The program that builds this site, the benchmark harness behind this page and the Salam code formatter are all written in Salam.

One program, two languages

Both of these are the same program. They produce the same output and compile to the same executable.

In English
functions.salam
func fibonacci(n: int): int:
    if n < 2:
        ret n
    end
    ret fibonacci(n - 1) + fibonacci(n - 2)
end

func main:
    repeat 10 in i:
        print fibonacci(i), ""
    end
    println ""
end
Output0 1 1 2 3 5 8 13 21 34
In Persian
functions_fa.salam
تابع فیبوناچی(ن: صحیح): صحیح:
    اگر ن < ۲:
        برگشت ن
    پایان
    برگشت فیبوناچی(ن - ۱) + فیبوناچی(ن - ۲)
پایان

تابع ریشه:
    تکرار ۱۰ در ک:
        چاپ فیبوناچی(ک), ""
    پایان
    سرچاپ ""
پایان
Output0 1 1 2 3 5 8 13 21 34

Want to move your code from one to the other? salam translate rewrites keywords, types and the entry point for you.

Three steps to your first program

Installing takes under a minute and needs nothing else on the machine.

Install

Run this in a Linux or macOS terminal. The Windows command is on the install page.

{ 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

Write

Create a file with a salam extension and write your first program.

echo 'func main: println "Hello, world!" end' > hello.salam

Run

Compile and run it with one command.

salam run hello.salam

For everywhere code runs

Salam is built and tested across operating systems and architectures.

  • Linux
  • macOS
  • Windows
  • 32-bit (i686 and ARM)
  • WebAssembly
  • Browser (JavaScript)
  • x86-64
  • ARM64

An assistant that speaks Salam

Ask questions, get working code and let it build your project on your own computer.

Frequently asked questions about Salam

What is Salam?

Salam is a general-purpose, statically typed, open source programming language. Its distinguishing feature is that it is fully bilingual: you can write a program in English or in Persian, and either way it compiles to a native executable for Linux, macOS, Windows and the web.

What does bilingual actually mean here?

Every keyword, built-in type, standard library package and compiler message has an English name and a Persian one, and the compiler accepts both. Persian digits are accepted wherever English ones are. The command salam translate en program.salam converts a Persian program to English, and translate fa goes the other way.

Is Salam fast?

Yes. Salam compiles to native machine code with no virtual machine and no garbage collector. Across our benchmark of 42 equivalent programs it ran on a par with C and Rust and many times faster than Python and PHP. The speed page has the numbers and the method.

What is Salam good for?

The same things any systems language is good for: command line tools, servers, compilers, numeric work, embedded and operating system code. The compiler itself is written in Salam, and so is an operating system and the program that builds this website.

Is Salam free and open source?

Yes. Salam is released under the GNU GPL version 3 and the full source is on GitHub.

Which operating systems does Salam run on?

Salam installs on Linux, macOS and Windows, and compiles programs for those plus WebAssembly and the browser. You can also write and run code in the online editor without installing anything.

Do I need to know Persian to use Salam?

No. The English form of the language is complete on its own: this site, the course and the standard library reference are all usable without a word of Persian. The Persian form is there for people who prefer it, and the two interoperate.

Try it right now

The Salam editor runs the whole compiler in your browser. Nothing to install: write code and see the result.