add numbers to parser

This commit is contained in:
2025-06-03 02:52:15 +01:00
parent e4c2af3cc7
commit ef61c391a1
7 changed files with 64 additions and 7 deletions

View File

@@ -1,9 +1,28 @@
#include "memory.h"
#include <gc.h>
#include <gc/gc.h>
#include <gmp.h>
#include <stdlib.h> // for malloc/free (temp arena fallback)
#include <string.h>
void ar_memory_init() { GC_INIT(); }
void *gmp_gc_realloc(void *ptr, size_t old_size, size_t new_size) {
(void)old_size; // Ignore old_size, Boehm doesn't need it
return GC_realloc(ptr, new_size);
}
void gmp_gc_free(void *ptr, size_t size) {
(void)size; // Boehm GC manages this itself
// No-op — memory will be collected automatically
GC_FREE(ptr);
}
void ar_memory_init() {
GC_INIT();
mp_set_memory_functions(GC_malloc, gmp_gc_realloc, gmp_gc_free);
}
void *ar_alloc(size_t size) { return GC_MALLOC(size); }