feat: switch to 64-bit integers and dynamic memory

Co-authored-by: aider (openrouter/deepseek/deepseek-v4-pro) <aider@aider.chat>
This commit is contained in:
2026-05-03 18:45:42 +03:00
parent a882bf6888
commit afd0a80dcb
6 changed files with 551 additions and 660 deletions
+5 -5
View File
@@ -1,11 +1,11 @@
#include "forth.h"
Word* add_primitive(const char* name, void (*code)(Word*), uint8_t flags) {
if (dict_idx >= DICT_SIZE) {
printf("Dictionary full\n");
return NULL;
Word* w = malloc(sizeof(Word));
if (!w) {
fprintf(stderr, "Out of memory\n");
exit(1);
}
Word* w = &dict[dict_idx++];
w->prev = dict_head;
dict_head = w;
@@ -21,7 +21,7 @@ Word* add_primitive(const char* name, void (*code)(Word*), uint8_t flags) {
Word* lookup_word(const char* name) {
for (Word* w = dict_head; w != NULL; w = w->prev) {
if (w->flags & (1 << 6)) continue; // Skip hidden words
if (w->flags & (1 << 6)) continue;
if (strcmp(w->name, name) == 0) return w;
}
return NULL;