Get started Browse docs
On this page 6 sections

Get started

Install the compiler

Build Orbit on your machine in three steps — clone, build, check — and get a single orbit executable you can run.

What you will get

One file, orbit (orbit.exe on Windows), sitting in the repository folder. You use it to turn .orb source files into programs. It takes about five minutes.

You build it yourself from the C source in the repository, so there is no package manager and nothing to download besides the code. Some releases also attach a Windows Setup Wizard; if the release you are installing from has one, you can use it instead.

“Self-hosted” means Orbit’s compiler is itself written in Orbit. The repository keeps a pre-translated C copy of it (the seed) so a C compiler can build it the first time. After that, the compiler can rebuild itself — that is what the checks further down confirm.

Requirements

You need three tools. Each has one job:

  • Git clones the repository.
  • Python 3.10 or newer runs the build and check scripts. They use only Python’s standard library, so there is nothing to pip install.
  • A C compiler (GCC, Clang or MSVC) does the final step. Orbit translates your program to C, and the C compiler turns that into the executable.

Which compiler fits your system:

Platform C compiler Python
Windows x86-64 Clang, MSVC, or GCC Python 3.10+
Linux x86-64 GCC or Clang Python 3.10+
macOS Clang Python 3.10+
PowerShell
$env:ORBIT_CC = "clang"
python scripts/trust.py build --cc $env:ORBIT_CC --out orbit.exe

Two tools are optional: VS Code, for the editor extension, and curl, which you will use later to call the services you build.

Build the compiler

Clone the repository, then run the build script. It compiles the C seed and produces your orbit executable:

PowerShell
git clone --branch feature/0.1.0-stability https://github.com/joacokhzyx/orbit-lang.git
cd orbit-lang
python scripts/trust.py build --out orbit.exe

The executable appears in the repository folder. Unless you add that folder to your PATH, run it by its local path. Every example in these docs does this: ./orbit on Linux and macOS, .\orbit.exe on Windows.

If you would rather type just orbit from anywhere, run the installer instead. It builds the compiler if needed, puts it in %USERPROFILE%\.orbit\bin (Windows) or ~/.orbit/bin (Linux and macOS), and registers the editor extension:

PowerShell
powershell -ExecutionPolicy Bypass -File scripts/install.ps1

Check that it works

Orbit ships three gate commands. Run them once after building. Run them from the repository folder, in this order. If one reports a failure, stop there and fix it before going on:

PowerShell
python scripts/trust.py verify --cc cl --emit-fixed-point .\orbit.exe
python scripts/corpus_gates.py parity --cc cl --compiler .\orbit.exe
python scripts/corpus_gates.py suite --cc cl --compiler .\orbit.exe

What each gate checks, in plain terms:

  • verify rebuilds the compiler from the C seed, then uses that new compiler to rebuild itself again. If the second result is identical to the first, the compiler has reached its fixed point: it reproduces itself exactly.
  • parity compiles a set of sample programs and compares the output with the saved expected results (the goldens). It catches code-generation changes the other tests would miss.
  • suite compiles and runs the test programs in tests/suite/. Each one reports its result through its exit code, which is the same habit you will use in your own programs.

In the commands above, gcc stands for your C compiler; use clang or cl if that is what you have. A platform only counts as supported when it passes all three gates with its documented compiler. Speed figures are never promised across machines: any number comes with its hardware, operating system, compiler, workload and how it was measured.

Editor setup

If you used the installer, the VS Code extension is already registered. To set it up by hand, follow editors/vscode/README.md in the repository. It gives you syntax highlighting and lives next to the compiler it describes.

Windows notes

Everything above works on Windows. Three details are worth knowing before you hit them:

  • Compiler. MSVC (--cc cl), Clang and GCC all work. If the build cannot find any, it stops with a message telling you to set ORBIT_CC. That message is the fix.
  • Programs that use a database need sqlite3.dll. Copy it from runtime/vendor/win-x64/ into the same folder as your .exe; Windows looks for it there when the program starts. Programs without a database, such as the health service on the next page, do not need it.
  • Version stamp (optional). On Windows, every program the compiler builds gets Orbit’s version info and icon. That needs windres or llvm-rc on your PATH. If neither is there, the build still succeeds, the program just has no stamp, and a note appears on stderr. Other systems skip this silently.

What next

Your compiler works. Next, write the smallest possible program and learn how to read its result: your first program. After that you will turn a program into a live web service: your first service. If something goes wrong on the way, troubleshooting lists the problems in the order you are most likely to meet them.

Type to search commands, errors, modules and concepts.