spice/bin/main.ml

13 lines
358 B
OCaml

open Spice
let[@warning "-26"] () =
Logs.set_reporter (Logs.format_reporter ());
Logs.set_level (Some Logs.Debug);
try
let ast = parse "val ret = 1 + 1 == 2" 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)