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.

hello.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
Output
In 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 170 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.

One program, two languages

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

english.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
persian.salam
تابع فیبوناچی(ن: صحیح): صحیح:
    اگر ن کوچکتر ۲:
        برگشت ن
    پایان
    برگشت فیبوناچی(ن - ۱) + فیبوناچی(ن - ۲)
پایان

تابع ریشه:
    تکرار ۱۰ در ک:
        چاپ فیبوناچی(ک), ""
    پایان
    سرچاپ ""
پایان

Three steps to your first program

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

1

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
2

Write

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

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

Run

Compile and run it with one command.

salam run hello.salam

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. On the 39 benchmark programs that use the same algorithm in every language it averaged 10.6 ms, against 11.7 ms for C and 11.3 ms for Rust, the same range, and Python took 56 times as long. 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.