diff --git a/bin/comp.ml b/bin/comp.ml index a15a935..e4cddd7 100644 --- a/bin/comp.ml +++ b/bin/comp.ml @@ -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 diff --git a/bin/dune b/bin/dune index e4478fc..3c961c2 100644 --- a/bin/dune +++ b/bin/dune @@ -1,4 +1,4 @@ (executable (name comp) (public_name ollisp) - (libraries str unix compiler interpreter)) + (libraries str unix compiler vm interpreter))