A small experimental compiler front-end written in Zig.
Important
This project uses nominated zig versions
nominated version: 0.16.0-dev.368+2a97e0af6
- Install the nominated zig version
- Build the project:
zig buildzig build run -- [options] <file_path>Options:
- --help, -h Print help message
- --version, -v Print version
- --debug, -d Enable debug mode
When debug mode is enabled Tokens, AST and Scopes will be printed when available.
<file_path> is the entrypoint file.
- Minimal empty program:
Each entrypoint file requires a public main function.
pub fn main() void {
}- Variable declaration:
pub fn main() void {
const a: u32 = 12;
const b: f32 = 12.3;
const int: type = i32;
const c: int = 13;
const d = 14;
var e: int = 15 + c;
var f := 16 + e * d;
}- Function declaration:
pub fn main() void {
const a = add(1, 2);
return;
}
fn add(a: u8, b: u8) u8 {
return a + b;
}