2023-11-29 22:56:42 +00:00
|
|
|
open Spice
|
|
|
|
|
2023-11-30 18:16:04 +00:00
|
|
|
let () =
|
2023-11-29 18:43:14 +00:00
|
|
|
Logs.set_reporter (Logs.format_reporter ());
|
|
|
|
Logs.set_level (Some Logs.Debug);
|
|
|
|
|
2023-11-24 04:06:13 +00:00
|
|
|
try
|
2023-11-30 18:52:05 +00:00
|
|
|
let ast = parse "val z = 5 val output = 1 + (({ val x = 3 val y = 4 x * y }) + z)" in
|
2023-11-30 03:24:51 +00:00
|
|
|
let prog = compile ast in
|
2023-11-29 22:56:42 +00:00
|
|
|
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)
|