LEVIATHAN v962456e · 962456eee1

leviathan-lang.com / docs / learn

Hello, Leviathan

Write and run the smallest useful program, and meet the compiler and the build driver.

Your first program

A Leviathan program is a set of declarations plus top-level statements that drive it. The smallest useful program is one line. console is an ordinary prelude object, and writeln is a real method on it (see Console).

The smallest program

console.writeln("Hello, Leviathan!");
Hello, Leviathan!

Running it

Source files use the .lev extension. The compiler binary is leviathan; the build driver you will actually run day to day is trident. To run a file directly through the tree-walk interpreter:

leviathan --run hello.lev        # execute on the oracle interpreter
trident run                      # ...or let trident drive a whole project

Where programs grow

As a program grows you will group code into namespaces and give it an entry point: a function to call, or a file whose top-level statements run. We get there in Shipping a project. For now, top-level statements are all you need.