blob: d5a443c97a0a82944afd2e0a1eddb76145ff2f21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#ifndef DUCC_PARSE_H
#define DUCC_PARSE_H
#include "ast.h"
#include "common.h"
#include "preprocess.h"
Program* parse(TokenArray* tokens);
bool pp_eval_constant_expr(TokenArray* pp_tokens);
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
|