binary: modify binary to make use of the new compilation pipeline
This commit is contained in:
+11
-9
@@ -1,16 +1,18 @@
|
||||
let ( let* ) = Result.bind;;
|
||||
|
||||
|
||||
|
||||
(* Try to interpret some test source code. *)
|
||||
let some_source = "(define (+ a b) b)
|
||||
(+ 1 2)";;
|
||||
(print 1)";;
|
||||
(* I don't have any built-in functions at all rn, so we just use a dummy function *)
|
||||
|
||||
let bruh =
|
||||
let* res = Interpreter.Main.interpret_src some_source in
|
||||
match res with
|
||||
| Int x -> Printf.printf "got %d as result\n" x; Ok ()
|
||||
| _ -> Printf.printf "got something else\n" ; Ok ()
|
||||
let _ =
|
||||
match bruh with
|
||||
| Error s -> Printf.printf "%s" s
|
||||
| _ -> ()
|
||||
let* vm = Compiler.Emit.compile_src some_source in
|
||||
Vm.Types.print_instrs vm.instrs;
|
||||
Vm.interpret vm;
|
||||
Ok (print_endline "hello")
|
||||
|
||||
let _ = match bruh with
|
||||
| Ok _ -> ()
|
||||
| Error s -> print_endline s
|
||||
|
||||
Reference in New Issue
Block a user