spice/bin/main.ml

13 lines
352 B
OCaml

open Spice
let () =
Logs.set_reporter (Logs.format_reporter ());
Logs.set_level (Some Logs.Debug);
try
let ast = parse "val output = min(4, min(2, 7))" 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)