aboutsummaryrefslogtreecommitdiff
path: root/src/cffc.hff
diff options
context:
space:
mode:
Diffstat (limited to 'src/cffc.hff')
-rw-r--r--src/cffc.hff24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/cffc.hff b/src/cffc.hff
index 2252373..aad2ee4 100644
--- a/src/cffc.hff
+++ b/src/cffc.hff
@@ -68,6 +68,7 @@ struct AggField {
ty *const Type,
off usize,
}
+struct EnumVal { name *const u8, i i64 }
struct Type {
size usize,
@@ -87,13 +88,20 @@ struct Type {
variadic bool,
ret *const Type,
},
+ Enum struct {
+ intty *const Type,
+ name *const u8,
+ lax bool,
+ id int,
+ vals [#]EnumVal,
+ },
Agg struct {
kind AggKind,
name *const u8,
id int,
fwd bool,
flds [#]AggField,
- decls [#]*Decl,
+ decls *Env,
},
},
@@ -190,6 +198,16 @@ struct Var {
fnid int,
}
+struct MacroCase {
+ variadic bool,
+ params [#]*const u8,
+ body [#]Tok,
+}
+
+struct Macro {
+ cs [#]MacroCase
+}
+
struct Decl {
name *const u8,
loc Loc,
@@ -199,6 +217,7 @@ struct Decl {
Static Var,
Def Expr,
Fn Fn,
+ Macro Macro,
Ty *const Type,
},
}
@@ -317,3 +336,6 @@ extern fn envput(*Env, Decl, **const Decl) *Decl;
extern fn envfind(*Env, *const u8) *Decl;
extern fn envfind_noparent(*Env, *const u8) *Decl;
extern fn envfree(*Env) void;
+
+// fold.cff
+extern fn fold(*Expr) bool;