spice/bin/main.ml

15 lines
434 B
OCaml

open Spice
let () =
Logs.set_reporter (Logs.format_reporter ());
Logs.set_level (Some Logs.Debug);
try
let ast = parse "val x = min(4, 7) println(min(x, 2))" in
Logs.debug (fun m -> m "%a" Ast.pp_modl ast);
let prog = compile ast in
Logs.debug (fun m -> m "%a" Code.pp_program prog);
let modl = run prog in
Logs.debug (fun m -> m "%a" Value.pp modl)
with Error msg -> Logs.err (fun m -> m "%s" msg)