A statically typed, C-like language compiling to x64 NASM and WebAssembly.
Group18 (g18) is a minimal, educational programming language implemented in Rust that compiles to x86-64 assembly. It demonstrates the complete pipeline of language implementation, from lexical analysis to code generation.
While the native compiler targets x64 NASM assembly, this online demo compiles to WebAssembly (WASM) to run directly in your browser.
Information on this page is sparse and not all-encompassing. Further reading is available and encouraged at the project's repository here.
For any questions, bug reports, or feedback, please contact me via email.
Note: The online WASM compiler is the bane of my existence. By nature, it will not display the informative and well-formatted error messages that the native x86-64 compiler provides. This is a limitation of the WASM environment. Further, If you encounter an issue where code that should compile successfully fails, this is exclusive behavior to the online WASM compiler and will not occur in the native x86-64 compiler. Please contact me in such cases.
main()
function. It is not strictly required that main() returns a specific type, or even
that it returns something at all.A typical Group18 program consists of function definitions, ending with a main function.
fn add(i32s a, i32s b) -> i32s {
return a + b;
}
fn main() -> i32s {
i32s result = add(5, 10);
print(result);
return 0;
}
for i in 0 to 10 { // Exclusive upper bound
// Loop body
}
if x > 5 {
print("Greater");
} else if x == 5 {
print("Equal");
} else {
print("Smaller");
}
i32s: Signed 32-bit integer (e.g., 42, -10)f32s: 32-bit floating point (e.g., 3.14)bool: Boolean (true, false)char: Single character ('a')string: Text string ("Hello")void: No return value