#ifndef UNDAR_COMMON_H #define UNDAR_COMMON_H #include "libc.h" #include "list.h" typedef enum symbol_type_e { SYMBOL_VOID, SYMBOL_BOOL, SYMBOL_BYTE, SYMBOL_INT, SYMBOL_NAT, SYMBOL_REAL, SYMBOL_STR, SYMBOL_U8, SYMBOL_I8, SYMBOL_I16, SYMBOL_U16, SYMBOL_I32, SYMBOL_U32, SYMBOL_F32, SYMBOL_ARRAY, SYMBOL_FUNCTION, SYMBOL_PLEX, SYMBOL_METHOD, SYMBOL_TRAIT, SYMBOL_CONST } SymbolType; typedef struct symbol_s Symbol; #define MAX_SYMBOL_NAME_LENGTH 64 struct symbol_s { char name[MAX_SYMBOL_NAME_LENGTH]; /* ptr to name */ u8 name_length; /* length of the name, max 64 */ SymbolType type; /* the type for this symbol */ SymbolType secondary_type; /* return type for functions/methods, or const if type/plex */ u32 ref; /* either constant value or pointer to other thing */ u32 size; /* either size of the plex or length of the array/list/etc. */ List *args; /* function params or plex constructor args */ List *fields; /* either plex variable fields, or method signatures */ }; #endif