binary: modify binary to make use of the new compilation pipeline

This commit is contained in:
2026-04-25 22:47:34 +03:00
parent 4716c71b15
commit 5edcc974b6
2 changed files with 12 additions and 10 deletions
+11 -9
View File
@@ -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
+1 -1
View File
@@ -1,4 +1,4 @@
(executable
(name comp)
(public_name ollisp)
(libraries str unix compiler interpreter))
(libraries str unix compiler vm interpreter))