From fece4fc3d4decb70c94b49ab854fa9ae93b4d887 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Fri, 14 Aug 2026 14:51:01 -0400 Subject: pit: More VM-style evaluation --- pit/include/lcq/pit/runtime.h | 1 + pit/include/lcq/pit/runtime/compile.h | 9 +++++++++ pit/include/lcq/pit/runtime/eval.h | 3 ++- pit/include/lcq/pit/runtime/value/func.h | 3 +-- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 pit/include/lcq/pit/runtime/compile.h (limited to 'pit/include') diff --git a/pit/include/lcq/pit/runtime.h b/pit/include/lcq/pit/runtime.h index 075d94c..70e65ca 100644 --- a/pit/include/lcq/pit/runtime.h +++ b/pit/include/lcq/pit/runtime.h @@ -98,6 +98,7 @@ void pit_repl(pit_runtime *rt); #include #include #include +#include #include #include diff --git a/pit/include/lcq/pit/runtime/compile.h b/pit/include/lcq/pit/runtime/compile.h new file mode 100644 index 0000000..ba0acb3 --- /dev/null +++ b/pit/include/lcq/pit/runtime/compile.h @@ -0,0 +1,9 @@ +#ifndef LCOLONQ_PIT_RUNTIME_COMPILE_H +#define LCOLONQ_PIT_RUNTIME_COMPILE_H + +#include + +pit_value pit_compile(pit_runtime *rt, pit_value top); +void pit_compile_install_special_forms(pit_runtime *rt); + +#endif diff --git a/pit/include/lcq/pit/runtime/eval.h b/pit/include/lcq/pit/runtime/eval.h index 41ec046..27df557 100644 --- a/pit/include/lcq/pit/runtime/eval.h +++ b/pit/include/lcq/pit/runtime/eval.h @@ -3,7 +3,8 @@ #include -pit_value pit_vm_compile(pit_runtime *rt, pit_value top); +bool pit_vm_run_one(pit_runtime *rt); pit_value pit_vm_eval(pit_runtime *rt, pit_value v); +pit_value pit_vm_apply(pit_runtime *rt, pit_value f, pit_value args); #endif diff --git a/pit/include/lcq/pit/runtime/value/func.h b/pit/include/lcq/pit/runtime/value/func.h index 852c90d..5855047 100644 --- a/pit/include/lcq/pit/runtime/value/func.h +++ b/pit/include/lcq/pit/runtime/value/func.h @@ -7,9 +7,8 @@ /* heavy value - func / nativefunc */ bool pit_value_is_func(pit_runtime *rt, pit_value a); bool pit_value_is_nativefunc(pit_runtime *rt, pit_value a); -pit_value pit_value_func_lambda(pit_runtime *rt, pit_value args, pit_value body); +pit_value pit_value_func_lambda(pit_runtime *rt, pit_value args, pit_value freevars, pit_value compiled); pit_value pit_value_nativefunc_new_with_data(pit_runtime *rt, pit_nativefunc f, void *data); pit_value pit_value_nativefunc_new(pit_runtime *rt, pit_nativefunc f); -pit_value pit_value_apply(pit_runtime *rt, pit_value f, pit_value args); #endif -- cgit v1.3.1