Skip to content
Adam
Start

Adam

A Pascal-style systems language with its own compiler, linker and debug-info writer, built in Adam itself, for Windows and Linux on x86_64.

What Adam is

Adam is a general-purpose systems programming language in the Pascal and Oberon line. Words open and close every block, := assigns and = compares, and every name is declared before it is used. Each source file is one module; a program is a module headed module exe <name>;, and its main block runs when it starts.

hello.adam
module exe hello;

begin
  println("Hello from Adam!");
end.
output on x86_64-windows-gnu and x86_64-linux-gnu
Hello from Adam!

There is no other toolchain behind it. Adam turns a program into x86_64 machine code with its own instruction encoder, writes the object files itself (COFF on Windows, ELF on Linux), links them with its own linkers and writes Windows debug info with its own PDB writer.

Ideas that shape it

  • Native from end to end. Source goes to machine code, object files, an executable and its debug info through Adam's own encoder, object writers, linkers and PDB writer.
  • It builds itself. The compiler is written in Adam. A new compiler is installed only when the compiler it built, and the one that compiler built in turn, are the same byte for byte.
  • Two targets, one source. x86_64-windows-gnu and x86_64-linux-gnu, each named by its triple; a build defines TARGET_<triple>, so @ifdef picks code for one of them. From Windows, a Linux program is built and run under WSL.
  • C is a declaration away. A clink routine with an external clause is the whole binding; adam cimport writes a binding unit from a library's headers.
  • Errors speak Adam. A mistake is reported at the .adam file, line and column, with a code, before anything is built.

Finding your way

Every program on these pages is a file that the docs' check builds and runs on both targets; the output shown is the output it must print.

Getting Adam

Adam is open source under the Mozilla Public License 2.0. Its source lives on GitHub, and its site is adamlang.org.

↑ ↓ moveEnter openEsc close