43 lines
812 B
Text
43 lines
812 B
Text
// #module_parameters(RUN_TESTS := false);
|
|
|
|
#load "parser.jai";
|
|
#load "interp.jai";
|
|
|
|
#scope_module;
|
|
|
|
// exported to the entire module since we want these everywhere
|
|
|
|
mem :: #import "jc/memory";
|
|
array :: #import "jc/array";
|
|
kv :: #import "jc/kv";
|
|
|
|
basic :: #import "Basic"; // @future
|
|
strings :: #import "String"; // @future
|
|
|
|
#scope_file;
|
|
|
|
#run {
|
|
parser: Parser;
|
|
init(*parser, context.allocator);
|
|
|
|
ok := parse_string(*parser, #string END
|
|
fn add(x, y) do return x + y end
|
|
fn sub(x, y) do return x - y end
|
|
|
|
var x = 11.0
|
|
var y = 22.0
|
|
|
|
print add(x, y)
|
|
print add(x+1.0, y)
|
|
END);
|
|
|
|
interp: Interp;
|
|
interp.toplevel = parser.toplevel;
|
|
init(*interp, context.allocator);
|
|
|
|
interp_program(*interp);
|
|
}
|
|
|
|
// #if RUN_TESTS {
|
|
// test :: #import "jc/test";
|
|
// }
|