Lexer partially working

This commit is contained in:
2022-08-03 14:06:54 +01:00
parent 3cad70dddd
commit 1ff32fe101
17 changed files with 687 additions and 34 deletions

22
source/memory.c Normal file
View File

@@ -0,0 +1,22 @@
#include "memory.h"
#include <stdio.h>
#include <stdlib.h>
void* reallocate(void* pointer, size_t oldSize, size_t newSize) {
if (newSize == 0) {
free(pointer);
return NULL;
}
void* mem = realloc(pointer, newSize);
if (mem == NULL) {
fprintf(stderr, "[Internal]Memory allocation error (requested %d for %d, replacing %d)\n", (int)newSize, (int)pointer, (int)oldSize);
exit(-1);
}
return mem;
}