diff options
Diffstat (limited to 'src/parse.h')
| -rw-r--r-- | src/parse.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/parse.h b/src/parse.h index 17ffe2c..d5a443c 100644 --- a/src/parse.h +++ b/src/parse.h @@ -7,6 +7,37 @@ Program* parse(TokenArray* tokens); bool pp_eval_constant_expr(TokenArray* pp_tokens); -void eval_init_expr(StrBuilder* buf, AstNode* expr, Type* ty); + +typedef enum { + InitDataBlockKind_addr, + InitDataBlockKind_bytes, +} InitDataBlockKind; + +// Static address to global variable or ROM area. +typedef struct { + const char* label; +} InitDataBlockAddr; + +// Static byte array. +typedef struct { + size_t len; + const char* buf; +} InitDataBlockBytes; + +typedef struct { + InitDataBlockKind kind; + union { + InitDataBlockAddr addr; + InitDataBlockBytes bytes; + } as; +} InitDataBlock; + +typedef struct { + size_t len; + size_t capacity; + InitDataBlock* blocks; +} InitData; + +InitData* eval_init_expr(AstNode* expr, Type* ty); #endif |
