Overview

Rivet is a general purpose programming language designed for the development of stable and safe software.

Rivet uses the C programming language as its main backend.

Note

Before continuing, I assume you know how to use a console, otherwise you can read this tutorial: The Linux command line for beginners.

Run the compiler

Dependencies

  • The compiler requires Python 3.

  • The Rivet compiler currently generates C code, so a C compiler, which supports C11,

    is required to generate executables. Over time the compiler will add support for generating binaries directly without the need for a C compiler.

The compiler has been tested on linux and windows.

Just execute python3 rivetc some_file.ri.

You can see all available compiler options by using the -h/--help flag.

python3 rivetc -h

Hello World!

Let’s start with the typical Hello World!:

We create a file called hello_world.ri with the following content:

import "std/console";

fn main() {
    console.println("Hello World!");
}

Then we compile that file:

$ python3 rivetc hello_world.ri

We’ll get an executable called hello_world as output, so we run it:

$ ./hello_world

We should see this output:

Hello World!

Excellent! You have compiled your first program in Rivet!

Editor/IDE support

  • LiteXL (Syntax-highlighting only).