Tiny lang is a toy programming language written to have fun.
git clone https://github.com/vivekascoder/tiny_lang
cd tiny_lang
cargo install --path .
tiny_lang interpret ./examples/main.tiny
tiny_lang repl --with (ast/lex/interpret)
To compile the tiny program into machine code use the following command.
tiny_lang compile ./examples/main.tiny
chmod +x ./a.out
./a.out
🗒️ NOTE: Make sure you have llvm installed in your system along with
clang, as we rely on llc
and clang
to compile.
cp -r ./syntax ~/.vscode/extensions/
After restarting your VsCode, you'll have tiny lang syntax support.
/**
* calculate sum of fibonacci sequence using tiny lang.
**/
extern fun printf(s: *i8, ...) => usize;
fun fibo(num: usize) => usize {
if (num == 0) {
return 0;
} else {
if (num == 1) {
return 1;
} else {
return fibo(num - 1) + fibo(num - 2);
}
}
}
fun main() => usize {
printf("%d", fibo(5));
return 0;
}
Check out the examples folder.