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;;
|
let ( let* ) = Result.bind;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(* Try to interpret some test source code. *)
|
(* Try to interpret some test source code. *)
|
||||||
let some_source = "(define (+ a b) b)
|
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 *)
|
(* I don't have any built-in functions at all rn, so we just use a dummy function *)
|
||||||
|
|
||||||
let bruh =
|
let bruh =
|
||||||
let* res = Interpreter.Main.interpret_src some_source in
|
let* vm = Compiler.Emit.compile_src some_source in
|
||||||
match res with
|
Vm.Types.print_instrs vm.instrs;
|
||||||
| Int x -> Printf.printf "got %d as result\n" x; Ok ()
|
Vm.interpret vm;
|
||||||
| _ -> Printf.printf "got something else\n" ; Ok ()
|
Ok (print_endline "hello")
|
||||||
let _ =
|
|
||||||
match bruh with
|
let _ = match bruh with
|
||||||
| Error s -> Printf.printf "%s" s
|
| Ok _ -> ()
|
||||||
| _ -> ()
|
| Error s -> print_endline s
|
||||||
|
|||||||
Reference in New Issue
Block a user