This commit is contained in:
Mid
2025-02-27 20:10:02 +02:00
parent f349fc1d56
commit 2c6033e501
13 changed files with 966 additions and 297 deletions

View File

@@ -5,7 +5,7 @@
#include<stdint.h>
typedef enum {
TYPE_TYPE_PRIMITIVE, TYPE_TYPE_COMPOUND, TYPE_TYPE_POINTER, TYPE_TYPE_FUNCTION, TYPE_TYPE_ARRAY, TYPE_TYPE_ERROR
TYPE_TYPE_PRIMITIVE, TYPE_TYPE_RECORD, TYPE_TYPE_POINTER, TYPE_TYPE_FUNCTION, TYPE_TYPE_ARRAY, TYPE_TYPE_ERROR
} TypeType;
union Type;
@@ -51,6 +51,19 @@ typedef struct TypeArray {
size_t length; /* 0 means unknown */
} TypeArray;
typedef struct TypeRecord {
TypeType type;
char *name;
size_t size;
union Type **fieldTypes;
size_t *fieldOffsets;
char **fieldNames;
size_t fieldCount;
} TypeRecord;
typedef union Type {
TypeType type;
@@ -58,6 +71,7 @@ typedef union Type {
TypePointer pointer;
TypeFunction function;
TypeArray array;
TypeRecord record;
} Type;
extern Type TYPE_ERROR;