1
0
Fork 0
undar-lang-register/src/tools/compiler.h

39 lines
919 B
C

#ifndef UNDAR_COMPILER_H
#define UNDAR_COMPILER_H
#include "../vm/common.h"
#include "../vm/vm.h"
#include "../vm/fixed.h"
#include "lexer.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct field_s {
char* name; // "handle"
TokenType type; // TOKEN_TYPE_NAT
u32 offset; // 4 (for first field in heap object)
u32 size; // 4 (bytes for nat)
} Field;
typedef struct plex_def_s {
char* name;
u32 field_count;
u32 logical_size; // Data size (e.g., 12 for Vec3)
u32 physical_size; // Total allocation (logical + 4)
Field *fields; // All offsets are PHYSICAL
} PlexDef;
typedef struct array_def_s {
TokenType type;
u32 length;
u32 logical_size; // length * element_size
u32 physical_size; // logical_size + 4
} ArrayDef;
bool compile(const char *source, VM *vm);
#endif