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.
module exe hello;
begin
println("Hello from Adam!");
end.
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@ifdefpicks code for one of them. From Windows, a Linux program is built and run under WSL. - C is a declaration away. A
clinkroutine with anexternalclause is the whole binding;adam cimportwrites 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
- New to Adam? The Tour builds a first program, then takes one short stop at each part of the language.
- Looking for one part of the language? The Language pages take each part in turn: Modules, Lexical, Declarations, Types, Objects, Generics, Closures, Statements, Expressions, Concurrency, Intrinsics, Directives and Testing.
- Calling C? External declarations binds a C function, variable or type by declaring it, clink and cpplink says how
clinkandcpplinkname a symbol and pass its parameters, and adam cimport writes a whole library's binding unit from its headers. - Looking for a unit of the standard library? Standard library lists every public type, constant and routine, read from the units' own documentation. The C libraries that ship with Adam, and the units over them, are on Vendored libraries.
- Building and running? Building takes a main module to an exe, The adam command covers the adam command, Projects the project file, Targets Windows and Linux, Diagnostics the reports and The runtime what every program carries.
- Writing and debugging? The Adam The Adam editor checks, builds, runs and debugs your code; The language server brings the same checks to any editor that speaks LSP, the The debugger works at a prompt or in an editor, The test suite covers adamtest's test rows, and The benchmark suite times Adam beside C on your own machine.
- Looking up a word or a code? The Grammar gives the shape of every construct; the Reference lists every keyword, directive, intrinsic, diagnostic, command and option, read from the compiler's own tables.
- Stuck? The FAQ answers what people ask first; Known issues says what does not work yet and what to do meanwhile.
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.