aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/cc.h
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-29 17:18:16 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-29 17:18:16 -0700
commit038ea2d0a34fb362f577e6c9884c710ebaf4042e (patch)
tree5c8b9adc412f527e438006f83cc1cf076cc266e0 /sys/cmd/cc/cc.h
parent3b2503978998ee1e8d4aeebbdbfb743f125e1b5e (diff)
feat: cc parser prototype finished
Diffstat (limited to 'sys/cmd/cc/cc.h')
-rw-r--r--sys/cmd/cc/cc.h48
1 files changed, 32 insertions, 16 deletions
diff --git a/sys/cmd/cc/cc.h b/sys/cmd/cc/cc.h
index 44b0037..cf97233 100644
--- a/sys/cmd/cc/cc.h
+++ b/sys/cmd/cc/cc.h
@@ -361,7 +361,7 @@ enum
Xref, Xstar, Xplus, Xminus, Xneg, Xnot, Xsizeof, Xalignof, Xpreinc, Xpredec,
Xcast,
/* unary postfix ops */
- Xpostinc, Xpostdec, Xindex, Xcall, Xselp, Xself, Xcmpdlit,
+ Xpostinc, Xpostdec, Xindex, Xcall, Xselp, Xself, Xinitlist,
/* binary ops */
Xoror, Xandand, Xor, Xxor, Xand, Xneq, Xeql, Xgt, Xlt, Xgteq, Xlteq, Xlsft, Xrsft,
Xadd, Xsub, Xmul, Xdiv, Xmod,
@@ -383,14 +383,16 @@ enum
};
/* expressions */
+enum
+{
+ Keynil,
+ Keyidx,
+ Keysel,
+};
+
struct Key
{
- /*
- * NOTE: bitpacked
- * lower 32 -> index into designator array
- * upper 32 -> type
- */
- uint64 kind;
+ uint kind : 2;
union {
Expr *x;
string s;
@@ -400,17 +402,18 @@ struct Key
struct Expr
{
struct Node;
- int32 type;
+ uint32 qual;
+ uint32 type;
union {
struct {
uint64 kind;
union Val;
} val;
struct {
- int n;
- struct Key *key;
- Expr *val;
- } cmpd;
+ int n;
+ struct Key *k;
+ Expr *v;
+ } init;
Expr *x;
struct {
Expr *l;
@@ -436,10 +439,23 @@ struct Expr
union {
Expr *pre;
Expr *post;
- } unary;
+ } unary;
struct {
- int32 to;
- Expr *x;
+ int type : 1;
+ union {
+ struct {
+ uint32 qual;
+ uint32 type;
+ } of;
+ Expr *x;
+ };
+ } info;
+ struct {
+ struct {
+ uint32 qual;
+ uint32 type;
+ } to;
+ Expr *x;
} cast;
struct {
Expr *l;
@@ -677,7 +693,7 @@ struct Type
/* platform specific */
extern Type pointer;
-extern Type basetypes[22];
+extern Type basetypes[23];
/* mandated by C standard */
extern uint64 validtypespec[40];
extern int indextypespec[40];