From 1c25c197d860ad49bb6a84e077a54e5aaf441bbd Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 17 Aug 2022 22:47:36 +0200 Subject: parse defmacro --- src/cffc.hff | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/cffc.hff') 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; -- cgit v1.2.3