15 lines
464 B
OCaml
15 lines
464 B
OCaml
open Spice
|
|
|
|
let () =
|
|
Logs.set_reporter (Logs.format_reporter ());
|
|
Logs.set_level (Some Logs.Debug);
|
|
|
|
try
|
|
let ast = parse "val two = 2 fun twice(x) x*two val r = twice(8)" in
|
|
Logs.debug (fun m -> m "[AST] %a" Ast.pp_modl ast);
|
|
let prog = compile ast in
|
|
Logs.debug (fun m -> Code.dump (m "[BC] %s") prog.main);
|
|
let modl = run prog in
|
|
Logs.debug (fun m -> m "[RET] %a" Value.pp modl)
|
|
with Error msg -> Logs.err (fun m -> m "%s" msg)
|