spice/bin/main.ml

13 lines
372 B
OCaml

open Spice
let () =
Logs.set_reporter (Logs.format_reporter ());
Logs.set_level (Some Logs.Debug);
try
let ast = parse "obj pos { val x = 3 val y = 4 } val result = pos.x" in
let prog = compile ast in
let ret = run prog in
Fmt.pr "{\"program\":%a,\"output\":%a}" Code.pp_program prog Value.pp ret
with Error msg -> Logs.err (fun m -> m "%s" msg)