13 lines
399 B
OCaml
13 lines
399 B
OCaml
open Spice
|
|
|
|
let[@warning "-26"] () =
|
|
Logs.set_reporter (Logs.format_reporter ());
|
|
Logs.set_level (Some Logs.Debug);
|
|
|
|
try
|
|
let ast = parse "val x = 3 val y = 5 val output = 2 * (if(9 < 8) x else 1 + y)" 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)
|