refactor: make interpreter portable with static pools and I/O hooks

Co-authored-by: aider (openrouter/moonshotai/kimi-k2.6) <aider@aider.chat>
This commit is contained in:
2026-05-03 22:35:21 +03:00
parent b115744991
commit f033187c6c
6 changed files with 145 additions and 153 deletions
+5 -3
View File
@@ -7,7 +7,6 @@
#include <ctype.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
// Configuration (all hard limits removed)
#define MAX_NAME_LEN 31
@@ -88,8 +87,11 @@ void inner_interpreter(void);
void process_token(const char* token);
void outer_interpreter(void);
// Ensure compile_buf has at least 'needed' free cells
void ensure_compile_cap(int32_t needed);
// Ensure compile_buf has at least 'needed' free cells (returns 0 on overflow)
int ensure_compile_cap(int32_t needed);
Word* forth_alloc_word(void);
Cell* forth_alloc_body(int32_t cells);
// Stack ops
void do_dup(Word* w);