aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/parse.h
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-10-01 01:04:30 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-10-05 00:38:49 +0200
commit2b0d4ead061a39da9dbd705c18c9955549c4d405 (patch)
tree1412ac39adce3428b96caf67b1e7543f6c1246a5 /src/prc1/parse.h
parent9140988be4e5bb028b7140aca1a67af1370c72a7 (diff)
downloadprc-2b0d4ead061a39da9dbd705c18c9955549c4d405.tar.gz
WIP symsym
Diffstat (limited to 'src/prc1/parse.h')
-rw-r--r--src/prc1/parse.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/prc1/parse.h b/src/prc1/parse.h
index 5d3d25a..97c7848 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,36 @@ 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;
@@ -79,14 +109,13 @@ struct pr
const struct tk *tk;
struct param *params, *ret;
size_t nparams;
- int variadic;
+ int using, returning, variadic;
};
struct td
{
const struct tk *tk;
struct type *types;
- size_t ntypes;
};
struct tmp
@@ -103,6 +132,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;