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;; 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
+1 -1
View File
@@ -1,4 +1,4 @@
(executable (executable
(name comp) (name comp)
(public_name ollisp) (public_name ollisp)
(libraries str unix compiler interpreter)) (libraries str unix compiler vm interpreter))