Initial commit, basic lexer structure

This commit is contained in:
2025-03-30 17:45:51 +02:00
commit df948b18c6
13 changed files with 794 additions and 0 deletions

21
src/error.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef INCLUDE_SRC_ERROR_H_
#define INCLUDE_SRC_ERROR_H_
#include <stdlib.h>
typedef struct error {
char *message;
bool is_heap_allocated;
} error_t;
error_t *errorf(const char *fmt, ...);
static inline void error_free(error_t *err) {
if (err == nullptr)
return;
if (!err->is_heap_allocated)
return;
free(err->message);
free(err);
}
#endif // INCLUDE_SRC_ERROR_H_