diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-10-01 01:04:30 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-10-11 00:14:35 +0200 |
| commit | 4ce39e4fc1de9536de7dedfe91b6dee38dec76ae (patch) | |
| tree | f9820f96b8eab624430c3700f32a2878a7036ee2 /src/prc1/parse.h | |
| parent | 9140988be4e5bb028b7140aca1a67af1370c72a7 (diff) | |
| download | prc-4ce39e4fc1de9536de7dedfe91b6dee38dec76ae.tar.gz | |
WIP sym + cgen
Diffstat (limited to 'src/prc1/parse.h')
| -rw-r--r-- | src/prc1/parse.h | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/prc1/parse.h b/src/prc1/parse.h index 5d3d25a..74380ed 100644 --- a/src/prc1/parse.h +++ b/src/prc1/parse.h @@ -49,7 +49,7 @@ struct builtin struct type { - enum {U, S, C, P, T, PTR, ARY, BUILTIN} type; + enum ttype {U, S, C, P, T, PTR, ARY, BUILTIN} type; const struct tk *tk; size_t sz, align; int sign; @@ -68,6 +68,37 @@ struct type } u; }; +struct sym +{ + enum symtype + { + SYM_ID, + SYM_TMP, + SYM_LIT, + SYM_CAST, + SYM_NUM, + SYM_ADDR, + SYM_SZ, + SYM_CNT, + SYM_OFF + } type; + + struct sym *child, *next, *parent; + const struct tk *tk; + + union + { + const struct tmp *tmp; + const struct type *t; + + struct + { + int sign; + union c c; + } num; + } u; +}; + struct param { const struct tk *tk; @@ -76,7 +107,7 @@ struct param struct pr { - const struct tk *tk; + const struct tk *tk, *using, *returning; struct param *params, *ret; size_t nparams; int variadic; @@ -86,7 +117,6 @@ struct td { const struct tk *tk; struct type *types; - size_t ntypes; }; struct tmp @@ -103,6 +133,7 @@ struct fn enum linkage {EXTERNAL, STATIC} linkage; struct storage *lk, *ws, *gl; struct stmt *stmts; + struct sym *syms; struct tmp *tmps; struct im *imps; struct pr *pr; @@ -121,6 +152,7 @@ struct lit struct ast { const struct args *args; + const struct type *littype; struct fn *fns; struct lit *lits, *lastlit; struct type *types; |
