repl: print errors encountered during compilation
This commit is contained in:
+8
-7
@@ -1,4 +1,3 @@
|
|||||||
let ( let* ) = Result.bind;;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -7,10 +6,12 @@ let ( let* ) = Result.bind;;
|
|||||||
|
|
||||||
let rec interpret_loop () =
|
let rec interpret_loop () =
|
||||||
let l = read_line () in
|
let l = read_line () in
|
||||||
let* vm = Compiler.Emit.compile_src l in
|
let vm = Compiler.Emit.compile_src l in
|
||||||
print_endline "=== PROGRAM DISASSEMBLY";
|
match vm with
|
||||||
Vm.Types.print_instrs vm.instrs;
|
| Ok vm ->
|
||||||
print_endline "=== PROGRAM OUTPUT";
|
print_endline "=== PROGRAM DISASSEMBLY";
|
||||||
Vm.interpret vm;
|
Vm.Types.print_instrs vm.instrs;
|
||||||
interpret_loop ()
|
print_endline "=== PROGRAM OUTPUT";
|
||||||
|
Vm.interpret vm; interpret_loop ()
|
||||||
|
| Error s -> print_endline s
|
||||||
let _ = interpret_loop ()
|
let _ = interpret_loop ()
|
||||||
|
|||||||
Reference in New Issue
Block a user