var fns := {add_one, mul_two, square}; fn add_one(a: u8) -> u8 { std.printf("adding one: %u8\n", a); return a + 1; } fn mul_two(a: u8) -> u8 { std.printf("mul by two: %u8\n", a); return a * 2; } fn square(a: u8) -> u8 { std.printf("squaring: %u8\n", a); return a * a; } fn main() { var x := 0; var a: u8 = 4; while x < 3 { a = fns[x](a); x++; } std.printf("finally: %u8\n", a); }
This is the repo of my programming language.
The main target of the compiler is my virtual machine but I plan to also use PeachPy at some point to produce x86_64 binaries and also a LLVM backend eventually.
wewcompiler/parser contains the language definition of my language wewcompiler/objects contains the AST nodes and IR generator
To run programs, install this package and run the program wewcompile
.
pip install -U .
wewcompile examples/fibonacci.wew program.bin
To run a program, use the virtual machine to execute the program.
cargo run -- program.bin