Oak programming language is a simple, fast, interpreter programming language for writing variouse applications.
- No immutable variables
- Easy to learn and use
- Free and open source
- Fast interpreter
- Lexer
- Parser
- Evaluator
- Add runtime libraries
To build oak compiler you need to write down this commands:
git clone https://github.com/solindekdev/oak cd oak node build.js && ./Build/oak --version
More about commands in compiler in command ./Build/oak --help
You can use Makefile too
git clone https://github.com/solindekdev/oak cd oak make && ./Build/oak --version
fn main [
push: "Hello, World!";
call: println;
]
On stack you can push every type
fn main [
push: "Roben";
push: 18;
]
You can pop from stack and save it in variable
fn get_name_and_age [
push: "Roben";
push: 18;
]
fn main [
call: get_name_and_age; # Calling to function
# Creating important variables
let: text_to_print | string;
let: name | string;
let: age | int;
# Pop from stack name and age
# they was push to stack in
# get_name_and_age function
pop: name;
pop: age;
# Add to string
text_to_print<>add: "Your name is ";
text_to_print<>add: name;
text_to_print<>add: " and you are ";
text_to_print<>add: age;
text_to_print<>add: " years old.";
# Push this string to stack
# and after it print it out
push: text_to_print;
call: println;
]
fn main [
# let: (HERE_NAME_OF_VAR) | (HERE_TYPE_OF_VAR);
# for example
let: is_oak_terrible_syntax | bool;
set: is_oak_terrible_syntax | true;
]
fn function_to_call [
push: "Function has been called";
call: println;
]
fn main [
push: "Before calling function";
call: println;
call: function_to_call;
push: "After calling function";
call: println;
]
main.oak
@import "./function.oak"
fn main [
call: function_from_import;
]
function.oak
fn function_from_import [
push: "Hello";
call: println;
]