Wave language overview
A practical introduction to Wave syntax, program structure, console I/O, and low-level facilities.
Wave Foundation
About Wave
Wave is a statically typed systems programming language designed for native code generation and explicit low-level control. Types, memory access, native interfaces, and target settings remain visible in source code and build commands.
First program
fun main() {
println("Hello, Wave!");
}
Save the source as main.wave and run it with:
wavec run main.wave
To build an executable without running it:
wavec build main.wave -o app
Hosted executables normally start at main. Freestanding builds can select another entry symbol together with the appropriate linker configuration.
Basic statement style
Wave keeps function signatures explicit. Local variables declare their type after the variable name.
fun add(left: i32, right: i32) -> i32 {
var result: i32 = left + right;
return result;
}
fun main() {
var count: i32 = 1;
var next: i32 = count + 1;
count += 1;
println("count = {}, next = {}", count, next);
}
var is the syntax for declaring a local variable. Local declarations use var name: Type = value; to state the variable type explicitly. const and static are top-level declarations.
Console I/O
print, println, and input are Wave console I/O statements. Their first argument is a string literal, and each {} placeholder corresponds to one following value.
fun main() {
var value: i32 = 0;
input("{}", value);
print("value = ");
println("{}", value);
}
Low-level facilities
Wave provides ptr<T>, address-of &, explicit deref, C ABI boundaries through extern(c) and export(c), and inline asm. Programs using these facilities define the ownership, bounds, alignment, and lifetime rules required by each memory or native API.
Suggested learning order
- Install the compiler and check
wavec --versionandwavec --help. - Learn declarations, types, expressions, and control flow.
- Learn functions, generics, structs, enums, and
proto. - Move on to pointers, imports, FFI, and the standard library.
- Use the compiler, Vex, Whale, target, and quick-reference pages as lookup material.