From 44ded39d1896e5150d15cb68aea3119741de69f7 Mon Sep 17 00:00:00 2001 From: Victor Borja Date: Mon, 9 Nov 2026 12:14:55 -0600 Subject: [PATCH] capability syntax (step A): `capability` with optional states (none: one state Live), `stop`, `transition r A -> B, ...`, defs that move by .. or .. ; in <> facts x: T is at(x, T), a r b is r(a, b), a r is r(a). The parser desugars to the same Ast; protocol/op/end still parse until the sources move --- bootstrap/s2c-seed.c | 65 ++++++++++++-- s2/parse.srs | 168 +++++++++++++++++++++++++++++++---- tests/s2/neg/cap_norel.srs | 10 +++ tests/s2/neg/cap_order.srs | 15 ++++ tests/s2/prog/capability.out | 1 + tests/s2/prog/capability.srs | 53 +++++++++++ 6 files changed, 284 insertions(+), 28 deletions(-) create mode 100644 tests/s2/neg/cap_norel.srs create mode 100644 tests/s2/neg/cap_order.srs create mode 100644 tests/s2/prog/capability.out create mode 100644 tests/s2/prog/capability.srs diff --git a/bootstrap/s2c-seed.c b/bootstrap/s2c-seed.c index 73af020d..c8e6bcc3 100644 --- a/bootstrap/s2c-seed.c +++ b/bootstrap/s2c-seed.c @@ -280,8 +280,20 @@ struct E_Parse__R__Ast__RuleDef; struct E_Parse__R__Coll__List_1_Ast__Trans; struct E_Parse__R__Ast__Op; struct E_Parse__R__Coll__List_1_Ast__Binder; +struct E_Parse__R__Parse__Moves; +struct E_Parse__Moves; +struct E_Parse__Entry; +struct E_Parse__R__Coll__Option_1_Sym__Sym; +struct E_Parse__R__Parse__Entry; +struct E_Parse__COp; +struct E_Parse__R__Parse__COp; struct E_Parse__R__Parse__Pr; struct E_Parse__Pr; +struct E_Coll__List__Parse__Rel; +struct E_Parse__Rel; +struct E_Coll__List__Parse__COp; +struct E_Coll__Option__Coll__List_1_Ast__Trans; +struct E_Parse__R__Coll__List_1_Ast__Op; struct E_Parse__R__Coll__List_1_Ast__Case; struct E_Parse__R__Coll__List_1_Ast__Group; struct E_Parse__R__Coll__List_1_Ast__Term; @@ -779,8 +791,20 @@ struct E_Parse__R__Ast__RuleDef { int64_t tag; union { struct { struct E_Ast__Ru struct E_Parse__R__Coll__List_1_Ast__Trans { int64_t tag; union { struct { struct E_Coll__List__Ast__Trans* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; struct E_Parse__R__Ast__Op { int64_t tag; union { struct { struct E_Ast__Op* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; struct E_Parse__R__Coll__List_1_Ast__Binder { int64_t tag; union { struct { struct E_Coll__List__Ast__Binder* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; +struct E_Parse__R__Parse__Moves { int64_t tag; union { struct { struct E_Parse__Moves* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; +struct E_Parse__Moves { int64_t tag; union { struct { struct E_Sym__Sym* f_from; struct E_Sym__Sym* f_to; } C_Parse__Move; struct { int64_t f_line; struct E_Sym__Sym* f_rel; } C_Parse__ByRel; struct { struct E_Coll__List__Ast__Trans* f_trans; } C_Parse__Written; int64_t none_; } u; }; +struct E_Parse__Entry { int64_t tag; union { struct { struct E_Sym__Sym* f_s; } C_Parse__EState; struct { struct E_Sym__Sym* f_s; struct E_Sym__Sym* f_r; struct E_Sym__Sym* f_t; } C_Parse__ERel; int64_t none_; } u; }; +struct E_Parse__R__Coll__Option_1_Sym__Sym { int64_t tag; union { struct { struct E_Coll__Option__Sym__Sym* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; +struct E_Parse__R__Parse__Entry { int64_t tag; union { struct { struct E_Parse__Entry* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; +struct E_Parse__COp { int64_t tag; union { struct { int64_t f_line; struct E_Sym__Sym* f_name; struct E_Coll__List__Ast__Binder* f_params; struct E_Ast__Ty* f_ret; struct E_Parse__Moves* f_moves; } C_Parse__COp; int64_t none_; } u; }; +struct E_Parse__R__Parse__COp { int64_t tag; union { struct { struct E_Parse__COp* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; struct E_Parse__R__Parse__Pr { int64_t tag; union { struct { struct E_Parse__Pr* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; -struct E_Parse__Pr { int64_t tag; union { struct { struct E_Coll__List__Sym__Sym* f_states; struct E_Sym__Sym* f_start; struct E_Coll__List__Sym__Sym* f_ends; struct E_Coll__Option__Sym__Sym* f_drop; struct E_Coll__List__Ast__Op* f_ops; struct E_Coll__List__Ast__RuleDef* f_rules; } C_Parse__Pr; int64_t none_; } u; }; +struct E_Parse__Pr { int64_t tag; union { struct { struct E_Coll__List__Sym__Sym* f_states; struct E_Sym__Sym* f_start; struct E_Coll__List__Sym__Sym* f_ends; struct E_Coll__Option__Sym__Sym* f_drop; struct E_Coll__List__Parse__COp* f_ops; struct E_Coll__List__Ast__RuleDef* f_rules; struct E_Coll__List__Parse__Rel* f_rels; } C_Parse__Pr; int64_t none_; } u; }; +struct E_Coll__List__Parse__Rel { int64_t tag; union { struct { struct E_Parse__Rel* f_h; struct E_Coll__List__Parse__Rel* f_t; } C_Coll__Cons; int64_t none_; } u; }; +struct E_Parse__Rel { int64_t tag; union { struct { struct E_Sym__Sym* f_name; struct E_Coll__List__Ast__Trans* f_pairs; } C_Parse__Rel; int64_t none_; } u; }; +struct E_Coll__List__Parse__COp { int64_t tag; union { struct { struct E_Parse__COp* f_h; struct E_Coll__List__Parse__COp* f_t; } C_Coll__Cons; int64_t none_; } u; }; +struct E_Coll__Option__Coll__List_1_Ast__Trans { int64_t tag; union { struct { struct E_Coll__List__Ast__Trans* f_v; } C_Coll__Some; int64_t none_; } u; }; +struct E_Parse__R__Coll__List_1_Ast__Op { int64_t tag; union { struct { struct E_Coll__List__Ast__Op* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; struct E_Parse__R__Coll__List_1_Ast__Case { int64_t tag; union { struct { struct E_Coll__List__Ast__Case* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; struct E_Parse__R__Coll__List_1_Ast__Group { int64_t tag; union { struct { struct E_Coll__List__Ast__Group* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; struct E_Parse__R__Coll__List_1_Ast__Term { int64_t tag; union { struct { struct E_Coll__List__Ast__Term* f_v; struct E_Coll__List__Lex__Tok* f_ts; } C_Parse__Ok; struct { int64_t f_line; srs_str f_want; } C_Parse__Err; int64_t none_; } u; }; @@ -1173,6 +1197,11 @@ static struct E_Lex__Why N_Lex__BadDedent = { 1, { 0 } }; static struct E_Lex__Why N_Lex__Unterminated = { 2, { 0 } }; static struct E_Lex__Why N_Lex__BadChar = { 3, { 0 } }; static struct E_Coll__Option__Parse__BinTok N_Coll__None__Parse__BinTok = { 0, { 0 } }; +static struct E_Parse__Moves N_Parse__Stay = { 0, { 0 } }; +static struct E_Parse__Entry N_Parse__ENone = { 0, { 0 } }; +static struct E_Coll__List__Parse__Rel N_Coll__Nil__Parse__Rel = { 0, { 0 } }; +static struct E_Coll__List__Parse__COp N_Coll__Nil__Parse__COp = { 0, { 0 } }; +static struct E_Coll__Option__Coll__List_1_Ast__Trans N_Coll__None__Coll__List_1_Ast__Trans = { 0, { 0 } }; static struct E_Parse__GKind N_Parse__GTypes = { 0, { 0 } }; static struct E_Parse__GKind N_Parse__GEvidence = { 1, { 0 } }; static struct E_Coll__Option__Ast__Cond N_Coll__None__Ast__Cond = { 0, { 0 } }; @@ -2925,11 +2954,20 @@ static struct E_Parse__R__Coll__List_1_Ast__Case* f_Parse__cases(srs_cap* p_eff_ static struct E_Coll__List__Ast__Case* f_Coll__rev__Ast__Case(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Case* p_xs); static struct E_Coll__List__Ast__Case* f_Coll__revOnto__Ast__Case(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Case* p_xs, struct E_Coll__List__Ast__Case* p_acc); static struct E_Parse__R__Ast__Decl* f_Parse__proto(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line); -static struct E_Coll__List__Ast__Op* f_Coll__rev__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs); -static struct E_Coll__List__Ast__Op* f_Coll__revOnto__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs, struct E_Coll__List__Ast__Op* p_acc); +static struct E_Coll__List__Parse__COp* f_Coll__rev__Parse__COp(srs_cap* p_eff__Region, struct E_Coll__List__Parse__COp* p_xs); +static struct E_Coll__List__Parse__COp* f_Coll__revOnto__Parse__COp(srs_cap* p_eff__Region, struct E_Coll__List__Parse__COp* p_xs, struct E_Coll__List__Parse__COp* p_acc); static struct E_Coll__List__Ast__RuleDef* f_Coll__rev__Ast__RuleDef(srs_cap* p_eff__Region, struct E_Coll__List__Ast__RuleDef* p_xs); static struct E_Coll__List__Ast__RuleDef* f_Coll__revOnto__Ast__RuleDef(srs_cap* p_eff__Region, struct E_Coll__List__Ast__RuleDef* p_xs, struct E_Coll__List__Ast__RuleDef* p_acc); +static struct E_Parse__R__Coll__List_1_Ast__Op* f_Parse__resolveOps(srs_cap* p_eff__Region, struct E_Coll__List__Parse__COp* p_os, struct E_Coll__List__Sym__Sym* p_ss, struct E_Coll__List__Parse__Rel* p_rels, struct E_Coll__List__Ast__Op* p_acc); +static struct E_Coll__List__Ast__Op* f_Coll__rev__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs); +static struct E_Coll__List__Ast__Op* f_Coll__revOnto__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs, struct E_Coll__List__Ast__Op* p_acc); +static struct E_Coll__List__Ast__Trans* f_Parse__stays(srs_cap* p_eff__Region, struct E_Coll__List__Sym__Sym* p_ss); +static struct E_Coll__Option__Coll__List_1_Ast__Trans* f_Parse__relPairs(srs_cap* p_eff__Region, struct E_Coll__List__Parse__Rel* p_rels, struct E_Sym__Sym* p_r); static struct E_Parse__R__Parse__Pr* f_Parse__items(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Parse__Pr* p_pr); +static struct E_Parse__R__Parse__COp* f_Parse__capDef(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line); +static struct E_Parse__R__Parse__Entry* f_Parse__entry(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts); +static struct E_Parse__R__Coll__Option_1_Sym__Sym* f_Parse__exitState(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts); +static struct E_Parse__R__Parse__Moves* f_Parse__moves(srs_cap* p_eff__Region, int64_t p_line, struct E_Parse__Entry* p_en, struct E_Coll__Option__Sym__Sym* p_ex); static struct E_Parse__R__Ast__Op* f_Parse__opDecl(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line); static struct E_Parse__R__Coll__List_1_Ast__Trans* f_Parse__trans(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Trans* p_acc); static struct E_Coll__List__Ast__Trans* f_Coll__rev__Ast__Trans(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Trans* p_xs); @@ -4729,7 +4767,7 @@ static struct E_Parse__R__Coll__List_1_Ast__Decl* f_Parse__file(srs_cap* p_eff__ static struct E_Parse__R__Coll__List_1_Ast__Decl* f_Parse__decls(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Decl* p_acc) { srs_tail: return ({ __auto_type res_ = (f_Parse__isNl(p_eff__Region, p_ts) ? ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__next(p_ts); struct E_Coll__List__Ast__Decl* t2 = p_acc; p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Decl*){0}; }) : (f_Parse__isEof(p_eff__Region, p_ts) ? ({ struct E_Parse__R__Coll__List_1_Ast__Decl* o0 = (struct E_Parse__R__Coll__List_1_Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Decl, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Decl*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = f_Coll__rev__Ast__Decl(p_eff__Region, p_acc); o0->u.C_Parse__Ok.f_ts = p_ts; o0; }) : ({ __auto_type s0 = f_Parse__decl(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Decl* o2 = (struct E_Parse__R__Coll__List_1_Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Decl, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_d_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = v_t1_1; struct E_Coll__List__Ast__Decl* t2 = ({ struct E_Coll__List__Ast__Decl* o2 = (struct E_Coll__List__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Decl, u) + sizeof(((struct E_Coll__List__Ast__Decl*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_d_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Decl*){0}; }); }); }))); res_; }); } static struct E_Coll__List__Ast__Decl* f_Coll__rev__Ast__Decl(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Decl* p_xs) { return f_Coll__revOnto__Ast__Decl(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__Decl)); } static struct E_Coll__List__Ast__Decl* f_Coll__revOnto__Ast__Decl(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Decl* p_xs, struct E_Coll__List__Ast__Decl* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Ast__Decl* t1 = v_t_1; struct E_Coll__List__Ast__Decl* t2 = ({ struct E_Coll__List__Ast__Decl* o2 = (struct E_Coll__List__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Decl, u) + sizeof(((struct E_Coll__List__Ast__Decl*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ast__Decl*){0}; }); }); }); } -static struct E_Parse__R__Ast__Decl* f_Parse__decl(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type res_ = (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"def", 3})) ? f_Parse__wrapFn(p_eff__Region, f_Parse__fn(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts), (&N_Parse__FDef))) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"extern", 6})) ? ({ __auto_type res_ = ({ __auto_type s0 = f_Parse__kw(p_eff__Region, f_Parse__next(p_ts), ((srs_str){(const uint8_t*)"def", 3})); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_t1_0 = s0->u.C_Parse__Ok.f_ts; f_Parse__wrapFn(p_eff__Region, f_Parse__fn(p_eff__Region, v_t1_0, f_Parse__line(p_eff__Region, p_ts), (&N_Parse__FExtern))); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"enum", 4})) ? f_Parse__enumDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"protocol", 8})) ? f_Parse__proto(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"handler", 7})) ? f_Parse__handler(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"trait", 5})) ? f_Parse__traitDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"given", 5})) ? f_Parse__givenDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"type", 4})) ? f_Parse__typeDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"val", 3})) ? f_Parse__topVal(p_eff__Region, f_Parse__valStmt(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts), false)) : ({ struct E_Parse__R__Ast__Decl* o0 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o0->tag = 1; o0->u.C_Parse__Err.f_line = f_Parse__line(p_eff__Region, p_ts); o0->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"declaration", 11}); o0; })))))))))); res_; }); } +static struct E_Parse__R__Ast__Decl* f_Parse__decl(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type res_ = (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"def", 3})) ? f_Parse__wrapFn(p_eff__Region, f_Parse__fn(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts), (&N_Parse__FDef))) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"extern", 6})) ? ({ __auto_type res_ = ({ __auto_type s0 = f_Parse__kw(p_eff__Region, f_Parse__next(p_ts), ((srs_str){(const uint8_t*)"def", 3})); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_t1_0 = s0->u.C_Parse__Ok.f_ts; f_Parse__wrapFn(p_eff__Region, f_Parse__fn(p_eff__Region, v_t1_0, f_Parse__line(p_eff__Region, p_ts), (&N_Parse__FExtern))); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"enum", 4})) ? f_Parse__enumDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : ((f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"capability", 10})) || f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"protocol", 8}))) ? f_Parse__proto(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"handler", 7})) ? f_Parse__handler(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"trait", 5})) ? f_Parse__traitDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"given", 5})) ? f_Parse__givenDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"type", 4})) ? f_Parse__typeDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"val", 3})) ? f_Parse__topVal(p_eff__Region, f_Parse__valStmt(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts), false)) : ({ struct E_Parse__R__Ast__Decl* o0 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o0->tag = 1; o0->u.C_Parse__Err.f_line = f_Parse__line(p_eff__Region, p_ts); o0->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"declaration", 11}); o0; })))))))))); res_; }); } static struct E_Parse__R__Ast__Decl* f_Parse__topVal(srs_cap* p_eff__Region, struct E_Parse__R__Ast__Stmt* p_rs) { return ({ __auto_type s0 = p_rs; s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_s_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = v_s_0; s2->tag == 0 ? ({ __auto_type v_line_2 = s2->u.C_Ast__Val.f_line; __auto_type v_x_3 = s2->u.C_Ast__Val.f_x; __auto_type v_ann_4 = s2->u.C_Ast__Val.f_ann; __auto_type v_e_5 = s2->u.C_Ast__Val.f_e; ({ __auto_type s6 = v_ann_4; s6->tag == 1 ? ({ __auto_type v_ty_6 = s6->u.C_Coll__Some.f_v; ({ struct E_Parse__R__Ast__Decl* o7 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Ok))); o7->tag = 0; o7->u.C_Parse__Ok.f_v = ({ struct E_Ast__Decl* o7 = (struct E_Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Decl, u) + sizeof(((struct E_Ast__Decl*)0)->u.C_Ast__DVal))); o7->tag = 7; o7->u.C_Ast__DVal.f_v = ({ struct E_Ast__Fn* o7 = (struct E_Ast__Fn*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Fn, u) + sizeof(((struct E_Ast__Fn*)0)->u.C_Ast__Fn))); o7->tag = 0; o7->u.C_Ast__Fn.f_line = v_line_2; o7->u.C_Ast__Fn.f_name = v_x_3; o7->u.C_Ast__Fn.f_groups = (&N_Coll__Nil__Ast__Group); o7->u.C_Ast__Fn.f_params = (&N_Coll__Nil__Ast__Binder); o7->u.C_Ast__Fn.f_ret = v_ty_6; o7->u.C_Ast__Fn.f_exit = (&N_Coll__Nil__Ast__Atom); o7->u.C_Ast__Fn.f_body = ({ struct E_Ast__Body* o7 = (struct E_Ast__Body*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Body, u) + sizeof(((struct E_Ast__Body*)0)->u.C_Ast__Def))); o7->tag = 0; o7->u.C_Ast__Def.f_cs = (&N_Coll__Nil__Ast__Clause); o7->u.C_Ast__Def.f_e = v_e_5; o7; }); o7; }); o7; }); o7->u.C_Parse__Ok.f_ts = v_t1_1; o7; }); }) : ({ ({ struct E_Parse__R__Ast__Decl* o6 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = v_line_2; o6->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"type of a top-level val (val x: T = e)", 38}); o6; }); }); }); }) : ({ ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = f_Parse__line(p_eff__Region, v_t1_1); o2->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"top-level val", 13}); o2; }); }); }); }); }); } static struct E_Parse__R__Ast__Decl* f_Parse__typeDecl(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_name_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__groups(p_eff__Region, v_t1_1, (&N_Coll__Nil__Ast__Group)); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o4 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_gs_2 = s2->u.C_Parse__Ok.f_v; __auto_type v_t2_3 = s2->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Coll__List_1_Ast__Binder* v_rv_4 = (f_Parse__isOp(p_eff__Region, v_t2_3, ((srs_str){(const uint8_t*)"(", 1})) ? f_Parse__params(p_eff__Region, v_t2_3) : ({ struct E_Parse__R__Coll__List_1_Ast__Binder* o4 = (struct E_Parse__R__Coll__List_1_Ast__Binder*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Binder, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Binder*)0)->u.C_Parse__Ok))); o4->tag = 0; o4->u.C_Parse__Ok.f_v = (&N_Coll__Nil__Ast__Binder); o4->u.C_Parse__Ok.f_ts = v_t2_3; o4; })); __auto_type res_ = ({ __auto_type s5 = v_rv_4; s5->tag == 1 ? ({ __auto_type v_l_5 = s5->u.C_Parse__Err.f_line; __auto_type v_w_6 = s5->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o7 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o7->tag = 1; o7->u.C_Parse__Err.f_line = v_l_5; o7->u.C_Parse__Err.f_want = v_w_6; o7; }); }) : ({ __auto_type v_vals_5 = s5->u.C_Parse__Ok.f_v; __auto_type v_t3_6 = s5->u.C_Parse__Ok.f_ts; ({ __auto_type s7 = f_Parse__op(p_eff__Region, v_t3_6, ((srs_str){(const uint8_t*)"=", 1})); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o9 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_t4_7 = s7->u.C_Parse__Ok.f_ts; ({ __auto_type s8 = f_Parse__typeBody(p_eff__Region, v_t4_7, v_vals_5); s8->tag == 1 ? ({ __auto_type v_l_8 = s8->u.C_Parse__Err.f_line; __auto_type v_w_9 = s8->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o10 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o10->tag = 1; o10->u.C_Parse__Err.f_line = v_l_8; o10->u.C_Parse__Err.f_want = v_w_9; o10; }); }) : ({ __auto_type v_b_8 = s8->u.C_Parse__Ok.f_v; __auto_type v_t5_9 = s8->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Ast__Decl* o10 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Ok))); o10->tag = 0; o10->u.C_Parse__Ok.f_v = ({ struct E_Ast__Decl* o10 = (struct E_Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Decl, u) + sizeof(((struct E_Ast__Decl*)0)->u.C_Ast__DType))); o10->tag = 6; o10->u.C_Ast__DType.f_t = ({ struct E_Ast__TypeDecl* o10 = (struct E_Ast__TypeDecl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__TypeDecl, u) + sizeof(((struct E_Ast__TypeDecl*)0)->u.C_Ast__TypeDecl))); o10->tag = 0; o10->u.C_Ast__TypeDecl.f_line = p_line; o10->u.C_Ast__TypeDecl.f_name = v_name_0; o10->u.C_Ast__TypeDecl.f_groups = v_gs_2; o10->u.C_Ast__TypeDecl.f_vals = v_vals_5; o10->u.C_Ast__TypeDecl.f_body = v_b_8; o10; }); o10; }); o10->u.C_Parse__Ok.f_ts = v_t5_9; o10; }); }); }); }); }); }); }); res_; }); }); }); }); }); } static struct E_Parse__R__Ast__TBody* f_Parse__typeBody(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Binder* p_vals) { return ({ __auto_type s0 = f_Parse__peek(p_eff__Region, p_ts); s0->tag == 0 ? ({ __auto_type v_x_0 = s0->u.C_Lex__TIdent.f_s; ({ __auto_type res_ = ((f_Parse__kwIs(f_Parse__second(p_eff__Region, p_ts), ((srs_str){(const uint8_t*)"match", 5})) && f_Parse__binderNamed(p_vals, v_x_0)) ? ({ __auto_type res_ = ({ __auto_type s1 = f_Parse__armsOpen(p_eff__Region, f_Parse__next(f_Parse__next(p_ts))); s1->tag == 1 ? ({ __auto_type v_l_1 = s1->u.C_Parse__Err.f_line; __auto_type v_w_2 = s1->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__TBody* o3 = (struct E_Parse__R__Ast__TBody*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__TBody, u) + sizeof(((struct E_Parse__R__Ast__TBody*)0)->u.C_Parse__Err))); o3->tag = 1; o3->u.C_Parse__Err.f_line = v_l_1; o3->u.C_Parse__Err.f_want = v_w_2; o3; }); }) : ({ __auto_type v_t1_1 = s1->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__valArms(p_eff__Region, v_t1_1, (&N_Coll__Nil__Ast__ValArm)); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__TBody* o4 = (struct E_Parse__R__Ast__TBody*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__TBody, u) + sizeof(((struct E_Parse__R__Ast__TBody*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_as_2 = s2->u.C_Parse__Ok.f_v; __auto_type v_t2_3 = s2->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Ast__TBody* o4 = (struct E_Parse__R__Ast__TBody*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__TBody, u) + sizeof(((struct E_Parse__R__Ast__TBody*)0)->u.C_Parse__Ok))); o4->tag = 0; o4->u.C_Parse__Ok.f_v = ({ struct E_Ast__TBody* o4 = (struct E_Ast__TBody*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__TBody, u) + sizeof(((struct E_Ast__TBody*)0)->u.C_Ast__ValMatch))); o4->tag = 2; o4->u.C_Ast__ValMatch.f_x = f_Sym__of(p_eff__Region, v_x_0); o4->u.C_Ast__ValMatch.f_arms = v_as_2; o4; }); o4->u.C_Parse__Ok.f_ts = v_t2_3; o4; }); }); }); }); }); res_; }) : f_Parse__tyBody(p_eff__Region, p_ts)); res_; }); }) : ({ f_Parse__tyBody(p_eff__Region, p_ts); }); }); } @@ -4770,7 +4808,7 @@ static struct E_Parse__R__Coll__List_1_Ast__Binder* f_Parse__binderTy(srs_cap* p static struct E_Parse__R__Coll__List_1_Ast__Binder* f_Parse__params(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type s0 = f_Parse__op(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"(", 1})); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Binder* o2 = (struct E_Parse__R__Coll__List_1_Ast__Binder*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Binder, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Binder*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_t1_0 = s0->u.C_Parse__Ok.f_ts; f_Parse__binders(p_eff__Region, v_t1_0, ((srs_str){(const uint8_t*)")", 1}), (&N_Coll__Nil__Ast__Binder)); }); }); } static struct E_Parse__R__Coll__List_1_Ast__Atom* f_Parse__exitFacts(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"<", 1})) ? f_Parse__atoms(p_eff__Region, f_Parse__next(p_ts), (&N_Coll__Nil__Ast__Atom)) : ({ struct E_Parse__R__Coll__List_1_Ast__Atom* o0 = (struct E_Parse__R__Coll__List_1_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Atom, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Atom*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = (&N_Coll__Nil__Ast__Atom); o0->u.C_Parse__Ok.f_ts = p_ts; o0; })); res_; }); } static struct E_Parse__R__Coll__List_1_Ast__Atom* f_Parse__atoms(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Atom* p_acc) { srs_tail: return ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)">", 1})) ? ({ struct E_Parse__R__Coll__List_1_Ast__Atom* o0 = (struct E_Parse__R__Coll__List_1_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Atom, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Atom*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = f_Coll__rev__Ast__Atom(p_eff__Region, p_acc); o0->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o0; }) : ({ __auto_type s0 = f_Parse__atom(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Atom* o2 = (struct E_Parse__R__Coll__List_1_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Atom, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Atom*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_a_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; (f_Parse__isOp(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)",", 1})) ? ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__next(v_t1_1); struct E_Coll__List__Ast__Atom* t2 = ({ struct E_Coll__List__Ast__Atom* o2 = (struct E_Coll__List__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Atom, u) + sizeof(((struct E_Coll__List__Ast__Atom*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_a_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Atom*){0}; }) : ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = v_t1_1; struct E_Coll__List__Ast__Atom* t2 = ({ struct E_Coll__List__Ast__Atom* o2 = (struct E_Coll__List__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Atom, u) + sizeof(((struct E_Coll__List__Ast__Atom*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_a_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Atom*){0}; })); }); })); res_; }); } -static struct E_Parse__R__Ast__Atom* f_Parse__atom(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o2 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_rel_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__op(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)"(", 1})); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o4 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_t2_2 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s3 = f_Parse__terms(p_eff__Region, v_t2_2, (&N_Coll__Nil__Ast__Term)); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_xs_3 = s3->u.C_Parse__Ok.f_v; __auto_type v_t3_4 = s3->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Ok))); o5->tag = 0; o5->u.C_Parse__Ok.f_v = ({ struct E_Ast__Atom* o5 = (struct E_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Atom, u) + sizeof(((struct E_Ast__Atom*)0)->u.C_Ast__Atom))); o5->tag = 0; o5->u.C_Ast__Atom.f_line = f_Parse__line(p_eff__Region, p_ts); o5->u.C_Ast__Atom.f_rel = v_rel_0; o5->u.C_Ast__Atom.f_args = v_xs_3; o5; }); o5->u.C_Parse__Ok.f_ts = v_t3_4; o5; }); }); }); }); }); }); }); } +static struct E_Parse__R__Ast__Atom* f_Parse__atom(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o2 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_a_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ int64_t v_line_2 = f_Parse__line(p_eff__Region, p_ts); __auto_type res_ = (f_Parse__isOp(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)"(", 1})) ? ({ __auto_type s3 = f_Parse__terms(p_eff__Region, f_Parse__next(v_t1_1), (&N_Coll__Nil__Ast__Term)); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_xs_3 = s3->u.C_Parse__Ok.f_v; __auto_type v_t3_4 = s3->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Ok))); o5->tag = 0; o5->u.C_Parse__Ok.f_v = ({ struct E_Ast__Atom* o5 = (struct E_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Atom, u) + sizeof(((struct E_Ast__Atom*)0)->u.C_Ast__Atom))); o5->tag = 0; o5->u.C_Ast__Atom.f_line = v_line_2; o5->u.C_Ast__Atom.f_rel = v_a_0; o5->u.C_Ast__Atom.f_args = v_xs_3; o5; }); o5->u.C_Parse__Ok.f_ts = v_t3_4; o5; }); }); }) : (f_Parse__isOp(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)":", 1})) ? ({ __auto_type s3 = f_Parse__ident(p_eff__Region, f_Parse__next(v_t1_1)); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_s_3 = s3->u.C_Parse__Ok.f_v; __auto_type v_t2_4 = s3->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Ok))); o5->tag = 0; o5->u.C_Parse__Ok.f_v = ({ struct E_Ast__Atom* o5 = (struct E_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Atom, u) + sizeof(((struct E_Ast__Atom*)0)->u.C_Ast__Atom))); o5->tag = 0; o5->u.C_Ast__Atom.f_line = v_line_2; o5->u.C_Ast__Atom.f_rel = f_Sym__of(p_eff__Region, ((srs_str){(const uint8_t*)"at", 2})); o5->u.C_Ast__Atom.f_args = ({ struct E_Coll__List__Ast__Term* o5 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_Ast__Term* o5 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TName))); o5->tag = 0; o5->u.C_Ast__TName.f_n = v_a_0; o5; }); o5->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__Ast__Term* o5 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_Ast__Term* o5 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TName))); o5->tag = 0; o5->u.C_Ast__TName.f_n = v_s_3; o5; }); o5->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Ast__Term); o5; }); o5; }); o5; }); o5->u.C_Parse__Ok.f_ts = v_t2_4; o5; }); }); }) : ({ __auto_type s3 = f_Parse__ident(p_eff__Region, v_t1_1); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_r_3 = s3->u.C_Parse__Ok.f_v; __auto_type v_t2_4 = s3->u.C_Parse__Ok.f_ts; ({ __auto_type s5 = f_Parse__peek(p_eff__Region, v_t2_4); s5->tag == 0 ? ({ __auto_type v_b_5 = s5->u.C_Lex__TIdent.f_s; ({ struct E_Parse__R__Ast__Atom* o6 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Ok))); o6->tag = 0; o6->u.C_Parse__Ok.f_v = ({ struct E_Ast__Atom* o6 = (struct E_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Atom, u) + sizeof(((struct E_Ast__Atom*)0)->u.C_Ast__Atom))); o6->tag = 0; o6->u.C_Ast__Atom.f_line = v_line_2; o6->u.C_Ast__Atom.f_rel = v_r_3; o6->u.C_Ast__Atom.f_args = ({ struct E_Coll__List__Ast__Term* o6 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = ({ struct E_Ast__Term* o6 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TName))); o6->tag = 0; o6->u.C_Ast__TName.f_n = v_a_0; o6; }); o6->u.C_Coll__Cons.f_t = ({ struct E_Coll__List__Ast__Term* o6 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = ({ struct E_Ast__Term* o6 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TName))); o6->tag = 0; o6->u.C_Ast__TName.f_n = f_Sym__of(p_eff__Region, v_b_5); o6; }); o6->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Ast__Term); o6; }); o6; }); o6; }); o6->u.C_Parse__Ok.f_ts = f_Parse__next(v_t2_4); o6; }); }) : ({ ({ struct E_Parse__R__Ast__Atom* o5 = (struct E_Parse__R__Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Atom, u) + sizeof(((struct E_Parse__R__Ast__Atom*)0)->u.C_Parse__Ok))); o5->tag = 0; o5->u.C_Parse__Ok.f_v = ({ struct E_Ast__Atom* o5 = (struct E_Ast__Atom*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Atom, u) + sizeof(((struct E_Ast__Atom*)0)->u.C_Ast__Atom))); o5->tag = 0; o5->u.C_Ast__Atom.f_line = v_line_2; o5->u.C_Ast__Atom.f_rel = v_r_3; o5->u.C_Ast__Atom.f_args = ({ struct E_Coll__List__Ast__Term* o5 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o5->tag = 1; o5->u.C_Coll__Cons.f_h = ({ struct E_Ast__Term* o5 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TName))); o5->tag = 0; o5->u.C_Ast__TName.f_n = v_a_0; o5; }); o5->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Ast__Term); o5; }); o5; }); o5->u.C_Parse__Ok.f_ts = v_t2_4; o5; }); }); }); }); }))); res_; }); }); }); } static struct E_Parse__R__Coll__List_1_Ast__Term* f_Parse__terms(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Term* p_acc) { srs_tail: return ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)")", 1})) ? ({ struct E_Parse__R__Coll__List_1_Ast__Term* o0 = (struct E_Parse__R__Coll__List_1_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Term, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Term*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = f_Coll__rev__Ast__Term(p_eff__Region, p_acc); o0->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o0; }) : ({ struct E_Parse__R__Ast__Term* v_tm_0 = ({ __auto_type s0 = f_Parse__peek(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_v_0 = s0->u.C_Lex__TInt.f_v; ({ struct E_Parse__R__Ast__Term* o1 = (struct E_Parse__R__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Term, u) + sizeof(((struct E_Parse__R__Ast__Term*)0)->u.C_Parse__Ok))); o1->tag = 0; o1->u.C_Parse__Ok.f_v = ({ struct E_Ast__Term* o1 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TNum))); o1->tag = 1; o1->u.C_Ast__TNum.f_v = v_v_0; o1; }); o1->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o1; }); }) : s0->tag == 0 ? ({ __auto_type v_x_0 = s0->u.C_Lex__TIdent.f_s; ({ struct E_Parse__R__Ast__Term* o1 = (struct E_Parse__R__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Term, u) + sizeof(((struct E_Parse__R__Ast__Term*)0)->u.C_Parse__Ok))); o1->tag = 0; o1->u.C_Parse__Ok.f_v = ({ struct E_Ast__Term* o1 = (struct E_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Term, u) + sizeof(((struct E_Ast__Term*)0)->u.C_Ast__TName))); o1->tag = 0; o1->u.C_Ast__TName.f_n = f_Sym__of(p_eff__Region, v_x_0); o1; }); o1->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o1; }); }) : ({ ({ struct E_Parse__R__Ast__Term* o0 = (struct E_Parse__R__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Term, u) + sizeof(((struct E_Parse__R__Ast__Term*)0)->u.C_Parse__Err))); o0->tag = 1; o0->u.C_Parse__Err.f_line = f_Parse__line(p_eff__Region, p_ts); o0->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"term", 4}); o0; }); }); }); __auto_type res_ = ({ __auto_type s1 = v_tm_0; s1->tag == 1 ? ({ __auto_type v_l_1 = s1->u.C_Parse__Err.f_line; __auto_type v_w_2 = s1->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Term* o3 = (struct E_Parse__R__Coll__List_1_Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Term, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Term*)0)->u.C_Parse__Err))); o3->tag = 1; o3->u.C_Parse__Err.f_line = v_l_1; o3->u.C_Parse__Err.f_want = v_w_2; o3; }); }) : ({ __auto_type v_t_1 = s1->u.C_Parse__Ok.f_v; __auto_type v_t1_2 = s1->u.C_Parse__Ok.f_ts; (f_Parse__isOp(p_eff__Region, v_t1_2, ((srs_str){(const uint8_t*)",", 1})) ? ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__next(v_t1_2); struct E_Coll__List__Ast__Term* t2 = ({ struct E_Coll__List__Ast__Term* o3 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = v_t_1; o3->u.C_Coll__Cons.f_t = p_acc; o3; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Term*){0}; }) : ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = v_t1_2; struct E_Coll__List__Ast__Term* t2 = ({ struct E_Coll__List__Ast__Term* o3 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o3->tag = 1; o3->u.C_Coll__Cons.f_h = v_t_1; o3->u.C_Coll__Cons.f_t = p_acc; o3; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Term*){0}; })); }); }); res_; })); res_; }); } static struct E_Coll__List__Ast__Term* f_Coll__rev__Ast__Term(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Term* p_xs) { return f_Coll__revOnto__Ast__Term(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__Term)); } static struct E_Coll__List__Ast__Term* f_Coll__revOnto__Ast__Term(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Term* p_xs, struct E_Coll__List__Ast__Term* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Ast__Term* t1 = v_t_1; struct E_Coll__List__Ast__Term* t2 = ({ struct E_Coll__List__Ast__Term* o2 = (struct E_Coll__List__Ast__Term*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Term, u) + sizeof(((struct E_Coll__List__Ast__Term*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ast__Term*){0}; }); }); }); } @@ -4784,12 +4822,21 @@ static struct E_Parse__R__Ast__Decl* f_Parse__enumDecl(srs_cap* p_eff__Region, s static struct E_Parse__R__Coll__List_1_Ast__Case* f_Parse__cases(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Case* p_acc) { srs_tail: return ({ __auto_type res_ = (f_Parse__isDedent(p_eff__Region, p_ts) ? ({ struct E_Parse__R__Coll__List_1_Ast__Case* o0 = (struct E_Parse__R__Coll__List_1_Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Case, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Case*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = f_Coll__rev__Ast__Case(p_eff__Region, p_acc); o0->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o0; }) : ({ __auto_type s0 = f_Parse__kw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"case", 4})); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Case* o2 = (struct E_Parse__R__Coll__List_1_Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Case, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Case*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_line_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__ident(p_eff__Region, v_t1_1); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Case* o4 = (struct E_Parse__R__Coll__List_1_Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Case, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Case*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_name_2 = s2->u.C_Parse__Ok.f_v; __auto_type v_t2_3 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, v_t2_3, ((srs_str){(const uint8_t*)"(", 1})) ? ({ __auto_type res_ = ({ __auto_type s4 = f_Parse__params(p_eff__Region, v_t2_3); s4->tag == 1 ? ({ __auto_type v_l_4 = s4->u.C_Parse__Err.f_line; __auto_type v_w_5 = s4->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Case* o6 = (struct E_Parse__R__Coll__List_1_Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Case, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Case*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = v_l_4; o6->u.C_Parse__Err.f_want = v_w_5; o6; }); }) : ({ __auto_type v_fs_4 = s4->u.C_Parse__Ok.f_v; __auto_type v_t3_5 = s4->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t3_5); struct E_Coll__List__Ast__Case* t2 = ({ struct E_Coll__List__Ast__Case* o6 = (struct E_Coll__List__Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Case, u) + sizeof(((struct E_Coll__List__Ast__Case*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = ({ struct E_Ast__Case* o6 = (struct E_Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Case, u) + sizeof(((struct E_Ast__Case*)0)->u.C_Ast__Case))); o6->tag = 0; o6->u.C_Ast__Case.f_line = v_line_0; o6->u.C_Ast__Case.f_name = v_name_2; o6->u.C_Ast__Case.f_fields = v_fs_4; o6; }); o6->u.C_Coll__Cons.f_t = p_acc; o6; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Case*){0}; }); }); }); res_; }) : ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t2_3); struct E_Coll__List__Ast__Case* t2 = ({ struct E_Coll__List__Ast__Case* o4 = (struct E_Coll__List__Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Case, u) + sizeof(((struct E_Coll__List__Ast__Case*)0)->u.C_Coll__Cons))); o4->tag = 1; o4->u.C_Coll__Cons.f_h = ({ struct E_Ast__Case* o4 = (struct E_Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Case, u) + sizeof(((struct E_Ast__Case*)0)->u.C_Ast__Case))); o4->tag = 0; o4->u.C_Ast__Case.f_line = v_line_0; o4->u.C_Ast__Case.f_name = v_name_2; o4->u.C_Ast__Case.f_fields = (&N_Coll__Nil__Ast__Binder); o4; }); o4->u.C_Coll__Cons.f_t = p_acc; o4; }); p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Case*){0}; })); res_; }); }); }); }); })); res_; }); } static struct E_Coll__List__Ast__Case* f_Coll__rev__Ast__Case(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Case* p_xs) { return f_Coll__revOnto__Ast__Case(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__Case)); } static struct E_Coll__List__Ast__Case* f_Coll__revOnto__Ast__Case(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Case* p_xs, struct E_Coll__List__Ast__Case* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Ast__Case* t1 = v_t_1; struct E_Coll__List__Ast__Case* t2 = ({ struct E_Coll__List__Ast__Case* o2 = (struct E_Coll__List__Ast__Case*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Case, u) + sizeof(((struct E_Coll__List__Ast__Case*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ast__Case*){0}; }); }); }); } -static struct E_Parse__R__Ast__Decl* f_Parse__proto(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_name_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__layoutOpen(p_eff__Region, v_t1_1); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o4 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_t2_2 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s3 = f_Parse__items(p_eff__Region, v_t2_2, ({ struct E_Parse__Pr* o3 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o3->tag = 0; o3->u.C_Parse__Pr.f_states = (&N_Coll__Nil__Sym__Sym); o3->u.C_Parse__Pr.f_start = f_Sym__of(p_eff__Region, ((srs_str){(const uint8_t*)"", 0})); o3->u.C_Parse__Pr.f_ends = (&N_Coll__Nil__Sym__Sym); o3->u.C_Parse__Pr.f_drop = (&N_Coll__None__Sym__Sym); o3->u.C_Parse__Pr.f_ops = (&N_Coll__Nil__Ast__Op); o3->u.C_Parse__Pr.f_rules = (&N_Coll__Nil__Ast__RuleDef); o3; })); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o5 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_pr_3 = s3->u.C_Parse__Ok.f_v; __auto_type v_t3_4 = s3->u.C_Parse__Ok.f_ts; ({ __auto_type res_ = ({ __auto_type s5 = v_pr_3; ({ __auto_type v_ss_5 = s5->u.C_Parse__Pr.f_states; __auto_type v_st_6 = s5->u.C_Parse__Pr.f_start; __auto_type v_es_7 = s5->u.C_Parse__Pr.f_ends; __auto_type v_dr_8 = s5->u.C_Parse__Pr.f_drop; __auto_type v_os_9 = s5->u.C_Parse__Pr.f_ops; __auto_type v_rs_10 = s5->u.C_Parse__Pr.f_rules; ({ __auto_type res_ = ({ struct E_Parse__R__Ast__Decl* o11 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Ok))); o11->tag = 0; o11->u.C_Parse__Ok.f_v = ({ struct E_Ast__Decl* o11 = (struct E_Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Decl, u) + sizeof(((struct E_Ast__Decl*)0)->u.C_Ast__DProto))); o11->tag = 2; o11->u.C_Ast__DProto.f_p = ({ struct E_Ast__Proto* o11 = (struct E_Ast__Proto*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Proto, u) + sizeof(((struct E_Ast__Proto*)0)->u.C_Ast__Proto))); o11->tag = 0; o11->u.C_Ast__Proto.f_line = p_line; o11->u.C_Ast__Proto.f_name = v_name_0; o11->u.C_Ast__Proto.f_states = v_ss_5; o11->u.C_Ast__Proto.f_start = v_st_6; o11->u.C_Ast__Proto.f_ends = v_es_7; o11->u.C_Ast__Proto.f_dropOp = v_dr_8; o11->u.C_Ast__Proto.f_ops = f_Coll__rev__Ast__Op(p_eff__Region, v_os_9); o11->u.C_Ast__Proto.f_rules = f_Coll__rev__Ast__RuleDef(p_eff__Region, v_rs_10); o11; }); o11; }); o11->u.C_Parse__Ok.f_ts = v_t3_4; o11; }); res_; }); }); }); res_; }); }); }); }); }); }); }); } -static struct E_Coll__List__Ast__Op* f_Coll__rev__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs) { return f_Coll__revOnto__Ast__Op(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__Op)); } -static struct E_Coll__List__Ast__Op* f_Coll__revOnto__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs, struct E_Coll__List__Ast__Op* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Ast__Op* t1 = v_t_1; struct E_Coll__List__Ast__Op* t2 = ({ struct E_Coll__List__Ast__Op* o2 = (struct E_Coll__List__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Op, u) + sizeof(((struct E_Coll__List__Ast__Op*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ast__Op*){0}; }); }); }); } +static struct E_Parse__R__Ast__Decl* f_Parse__proto(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o2 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_name_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__layoutOpen(p_eff__Region, v_t1_1); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o4 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_t2_2 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s3 = f_Parse__items(p_eff__Region, v_t2_2, ({ struct E_Parse__Pr* o3 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o3->tag = 0; o3->u.C_Parse__Pr.f_states = (&N_Coll__Nil__Sym__Sym); o3->u.C_Parse__Pr.f_start = f_Sym__of(p_eff__Region, ((srs_str){(const uint8_t*)"", 0})); o3->u.C_Parse__Pr.f_ends = (&N_Coll__Nil__Sym__Sym); o3->u.C_Parse__Pr.f_drop = (&N_Coll__None__Sym__Sym); o3->u.C_Parse__Pr.f_ops = (&N_Coll__Nil__Parse__COp); o3->u.C_Parse__Pr.f_rules = (&N_Coll__Nil__Ast__RuleDef); o3->u.C_Parse__Pr.f_rels = (&N_Coll__Nil__Parse__Rel); o3; })); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o5 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_pr_3 = s3->u.C_Parse__Ok.f_v; __auto_type v_t3_4 = s3->u.C_Parse__Ok.f_ts; ({ __auto_type res_ = ({ __auto_type s5 = v_pr_3; ({ __auto_type v_ss0_5 = s5->u.C_Parse__Pr.f_states; __auto_type v_st0_6 = s5->u.C_Parse__Pr.f_start; __auto_type v_es0_7 = s5->u.C_Parse__Pr.f_ends; __auto_type v_dr_8 = s5->u.C_Parse__Pr.f_drop; __auto_type v_os_9 = s5->u.C_Parse__Pr.f_ops; __auto_type v_rs_10 = s5->u.C_Parse__Pr.f_rules; __auto_type v_rels_11 = s5->u.C_Parse__Pr.f_rels; ({ struct E_Coll__List__Sym__Sym* v_live_12 = ({ struct E_Coll__List__Sym__Sym* o12 = (struct E_Coll__List__Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Sym__Sym, u) + sizeof(((struct E_Coll__List__Sym__Sym*)0)->u.C_Coll__Cons))); o12->tag = 1; o12->u.C_Coll__Cons.f_h = f_Sym__of(p_eff__Region, ((srs_str){(const uint8_t*)"Live", 4})); o12->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Sym__Sym); o12; }); struct E_Coll__List__Sym__Sym* v_ss_13 = ({ __auto_type s13 = v_ss0_5; s13->tag == 0 ? ({ v_live_12; }) : ({ v_ss0_5; }); }); struct E_Sym__Sym* v_st_14 = ({ __auto_type s14 = v_ss0_5; s14->tag == 0 ? ({ f_Sym__of(p_eff__Region, ((srs_str){(const uint8_t*)"Live", 4})); }) : ({ v_st0_6; }); }); struct E_Coll__List__Sym__Sym* v_es_15 = ({ __auto_type s15 = v_ss0_5; s15->tag == 0 ? ({ v_live_12; }) : ({ v_es0_7; }); }); __auto_type res_ = ({ __auto_type s16 = f_Parse__resolveOps(p_eff__Region, f_Coll__rev__Parse__COp(p_eff__Region, v_os_9), v_ss_13, v_rels_11, (&N_Coll__Nil__Ast__Op)); s16->tag == 1 ? ({ __auto_type v_l_16 = s16->u.C_Parse__Err.f_line; __auto_type v_w_17 = s16->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Decl* o18 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Err))); o18->tag = 1; o18->u.C_Parse__Err.f_line = v_l_16; o18->u.C_Parse__Err.f_want = v_w_17; o18; }); }) : ({ __auto_type v_aos_16 = s16->u.C_Parse__Ok.f_v; ({ struct E_Parse__R__Ast__Decl* o17 = (struct E_Parse__R__Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Decl, u) + sizeof(((struct E_Parse__R__Ast__Decl*)0)->u.C_Parse__Ok))); o17->tag = 0; o17->u.C_Parse__Ok.f_v = ({ struct E_Ast__Decl* o17 = (struct E_Ast__Decl*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Decl, u) + sizeof(((struct E_Ast__Decl*)0)->u.C_Ast__DProto))); o17->tag = 2; o17->u.C_Ast__DProto.f_p = ({ struct E_Ast__Proto* o17 = (struct E_Ast__Proto*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Proto, u) + sizeof(((struct E_Ast__Proto*)0)->u.C_Ast__Proto))); o17->tag = 0; o17->u.C_Ast__Proto.f_line = p_line; o17->u.C_Ast__Proto.f_name = v_name_0; o17->u.C_Ast__Proto.f_states = v_ss_13; o17->u.C_Ast__Proto.f_start = v_st_14; o17->u.C_Ast__Proto.f_ends = v_es_15; o17->u.C_Ast__Proto.f_dropOp = v_dr_8; o17->u.C_Ast__Proto.f_ops = v_aos_16; o17->u.C_Ast__Proto.f_rules = f_Coll__rev__Ast__RuleDef(p_eff__Region, v_rs_10); o17; }); o17; }); o17->u.C_Parse__Ok.f_ts = v_t3_4; o17; }); }); }); res_; }); }); }); res_; }); }); }); }); }); }); }); } +static struct E_Coll__List__Parse__COp* f_Coll__rev__Parse__COp(srs_cap* p_eff__Region, struct E_Coll__List__Parse__COp* p_xs) { return f_Coll__revOnto__Parse__COp(p_eff__Region, p_xs, (&N_Coll__Nil__Parse__COp)); } +static struct E_Coll__List__Parse__COp* f_Coll__revOnto__Parse__COp(srs_cap* p_eff__Region, struct E_Coll__List__Parse__COp* p_xs, struct E_Coll__List__Parse__COp* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Parse__COp* t1 = v_t_1; struct E_Coll__List__Parse__COp* t2 = ({ struct E_Coll__List__Parse__COp* o2 = (struct E_Coll__List__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Parse__COp, u) + sizeof(((struct E_Coll__List__Parse__COp*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Parse__COp*){0}; }); }); }); } static struct E_Coll__List__Ast__RuleDef* f_Coll__rev__Ast__RuleDef(srs_cap* p_eff__Region, struct E_Coll__List__Ast__RuleDef* p_xs) { return f_Coll__revOnto__Ast__RuleDef(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__RuleDef)); } static struct E_Coll__List__Ast__RuleDef* f_Coll__revOnto__Ast__RuleDef(srs_cap* p_eff__Region, struct E_Coll__List__Ast__RuleDef* p_xs, struct E_Coll__List__Ast__RuleDef* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Ast__RuleDef* t1 = v_t_1; struct E_Coll__List__Ast__RuleDef* t2 = ({ struct E_Coll__List__Ast__RuleDef* o2 = (struct E_Coll__List__Ast__RuleDef*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__RuleDef, u) + sizeof(((struct E_Coll__List__Ast__RuleDef*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ast__RuleDef*){0}; }); }); }); } -static struct E_Parse__R__Parse__Pr* f_Parse__items(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Parse__Pr* p_pr) { srs_tail: return ({ __auto_type res_ = ({ __auto_type s0 = p_pr; ({ __auto_type v_ss_0 = s0->u.C_Parse__Pr.f_states; __auto_type v_st_1 = s0->u.C_Parse__Pr.f_start; __auto_type v_es_2 = s0->u.C_Parse__Pr.f_ends; __auto_type v_dr_3 = s0->u.C_Parse__Pr.f_drop; __auto_type v_os_4 = s0->u.C_Parse__Pr.f_ops; __auto_type v_rs_5 = s0->u.C_Parse__Pr.f_rules; ({ __auto_type res_ = (f_Parse__isDedent(p_eff__Region, p_ts) ? ({ struct E_Parse__R__Parse__Pr* o6 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Ok))); o6->tag = 0; o6->u.C_Parse__Ok.f_v = p_pr; o6->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o6; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"state", 5})) ? ({ __auto_type res_ = ({ __auto_type s6 = f_Parse__nameLine(p_eff__Region, f_Parse__next(p_ts), (&N_Coll__Nil__Sym__Sym)); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o8 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_xs_6 = s6->u.C_Parse__Ok.f_v; __auto_type v_t1_7 = s6->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_7); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o8 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o8->tag = 0; o8->u.C_Parse__Pr.f_states = v_xs_6; o8->u.C_Parse__Pr.f_start = v_st_1; o8->u.C_Parse__Pr.f_ends = v_es_2; o8->u.C_Parse__Pr.f_drop = v_dr_3; o8->u.C_Parse__Pr.f_ops = v_os_4; o8->u.C_Parse__Pr.f_rules = v_rs_5; o8; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"start", 5})) ? ({ __auto_type res_ = ({ __auto_type s6 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o8 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_x_6 = s6->u.C_Parse__Ok.f_v; __auto_type v_t1_7 = s6->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_7); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o8 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o8->tag = 0; o8->u.C_Parse__Pr.f_states = v_ss_0; o8->u.C_Parse__Pr.f_start = v_x_6; o8->u.C_Parse__Pr.f_ends = v_es_2; o8->u.C_Parse__Pr.f_drop = v_dr_3; o8->u.C_Parse__Pr.f_ops = v_os_4; o8->u.C_Parse__Pr.f_rules = v_rs_5; o8; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"end", 3})) ? ({ __auto_type res_ = ({ __auto_type s6 = f_Parse__nameLine(p_eff__Region, f_Parse__next(p_ts), (&N_Coll__Nil__Sym__Sym)); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o8 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_xs_6 = s6->u.C_Parse__Ok.f_v; __auto_type v_t1_7 = s6->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_7); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o8 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o8->tag = 0; o8->u.C_Parse__Pr.f_states = v_ss_0; o8->u.C_Parse__Pr.f_start = v_st_1; o8->u.C_Parse__Pr.f_ends = v_xs_6; o8->u.C_Parse__Pr.f_drop = v_dr_3; o8->u.C_Parse__Pr.f_ops = v_os_4; o8->u.C_Parse__Pr.f_rules = v_rs_5; o8; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"drop", 4})) ? ({ __auto_type res_ = ({ __auto_type s6 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o8 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_x_6 = s6->u.C_Parse__Ok.f_v; __auto_type v_t1_7 = s6->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_7); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o8 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o8->tag = 0; o8->u.C_Parse__Pr.f_states = v_ss_0; o8->u.C_Parse__Pr.f_start = v_st_1; o8->u.C_Parse__Pr.f_ends = v_es_2; o8->u.C_Parse__Pr.f_drop = ({ struct E_Coll__Option__Sym__Sym* o8 = (struct E_Coll__Option__Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__Option__Sym__Sym, u) + sizeof(((struct E_Coll__Option__Sym__Sym*)0)->u.C_Coll__Some))); o8->tag = 1; o8->u.C_Coll__Some.f_v = v_x_6; o8; }); o8->u.C_Parse__Pr.f_ops = v_os_4; o8->u.C_Parse__Pr.f_rules = v_rs_5; o8; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"op", 2})) ? ({ __auto_type res_ = ({ __auto_type s6 = f_Parse__opDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o8 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_o_6 = s6->u.C_Parse__Ok.f_v; __auto_type v_t1_7 = s6->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_7); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o8 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o8->tag = 0; o8->u.C_Parse__Pr.f_states = v_ss_0; o8->u.C_Parse__Pr.f_start = v_st_1; o8->u.C_Parse__Pr.f_ends = v_es_2; o8->u.C_Parse__Pr.f_drop = v_dr_3; o8->u.C_Parse__Pr.f_ops = ({ struct E_Coll__List__Ast__Op* o8 = (struct E_Coll__List__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Op, u) + sizeof(((struct E_Coll__List__Ast__Op*)0)->u.C_Coll__Cons))); o8->tag = 1; o8->u.C_Coll__Cons.f_h = v_o_6; o8->u.C_Coll__Cons.f_t = v_os_4; o8; }); o8->u.C_Parse__Pr.f_rules = v_rs_5; o8; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"rule", 4})) ? ({ __auto_type res_ = ({ __auto_type s6 = f_Parse__kw(p_eff__Region, f_Parse__next(p_ts), ((srs_str){(const uint8_t*)"def", 3})); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o8 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_t1_6 = s6->u.C_Parse__Ok.f_ts; ({ __auto_type s7 = f_Parse__ruleDecl(p_eff__Region, v_t1_6, f_Parse__line(p_eff__Region, p_ts)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_rd_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t2_8 = s7->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t2_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o9 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o9->tag = 0; o9->u.C_Parse__Pr.f_states = v_ss_0; o9->u.C_Parse__Pr.f_start = v_st_1; o9->u.C_Parse__Pr.f_ends = v_es_2; o9->u.C_Parse__Pr.f_drop = v_dr_3; o9->u.C_Parse__Pr.f_ops = v_os_4; o9->u.C_Parse__Pr.f_rules = ({ struct E_Coll__List__Ast__RuleDef* o9 = (struct E_Coll__List__Ast__RuleDef*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__RuleDef, u) + sizeof(((struct E_Coll__List__Ast__RuleDef*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = v_rd_7; o9->u.C_Coll__Cons.f_t = v_rs_5; o9; }); o9; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); }); }); res_; }) : ({ struct E_Parse__R__Parse__Pr* o6 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = f_Parse__line(p_eff__Region, p_ts); o6->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"protocol item", 13}); o6; })))))))); res_; }); }); }); res_; }); } +static struct E_Parse__R__Coll__List_1_Ast__Op* f_Parse__resolveOps(srs_cap* p_eff__Region, struct E_Coll__List__Parse__COp* p_os, struct E_Coll__List__Sym__Sym* p_ss, struct E_Coll__List__Parse__Rel* p_rels, struct E_Coll__List__Ast__Op* p_acc) { srs_tail: return ({ __auto_type s0 = p_os; s0->tag == 0 ? ({ ({ struct E_Parse__R__Coll__List_1_Ast__Op* o0 = (struct E_Parse__R__Coll__List_1_Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Op, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Op*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = f_Coll__rev__Ast__Op(p_eff__Region, p_acc); o0->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o0; }); }) : ({ __auto_type v_o_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_o_0; ({ __auto_type v_line_2 = s2->u.C_Parse__COp.f_line; __auto_type v_name_3 = s2->u.C_Parse__COp.f_name; __auto_type v_ps_4 = s2->u.C_Parse__COp.f_params; __auto_type v_ret_5 = s2->u.C_Parse__COp.f_ret; __auto_type v_mv_6 = s2->u.C_Parse__COp.f_moves; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* v_rt_7 = ({ __auto_type s7 = v_mv_6; s7->tag == 0 ? ({ ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o7 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Ok))); o7->tag = 0; o7->u.C_Parse__Ok.f_v = f_Parse__stays(p_eff__Region, p_ss); o7->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o7; }); }) : s7->tag == 1 ? ({ __auto_type v_a_7 = s7->u.C_Parse__Move.f_from; __auto_type v_b_8 = s7->u.C_Parse__Move.f_to; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o9 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Ok))); o9->tag = 0; o9->u.C_Parse__Ok.f_v = ({ struct E_Coll__List__Ast__Trans* o9 = (struct E_Coll__List__Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Trans, u) + sizeof(((struct E_Coll__List__Ast__Trans*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = ({ struct E_Ast__Trans* o9 = (struct E_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Trans, u) + sizeof(((struct E_Ast__Trans*)0)->u.C_Ast__Trans))); o9->tag = 0; o9->u.C_Ast__Trans.f_from = v_a_7; o9->u.C_Ast__Trans.f_to = v_b_8; o9; }); o9->u.C_Coll__Cons.f_t = (&N_Coll__Nil__Ast__Trans); o9; }); o9->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o9; }); }) : s7->tag == 3 ? ({ __auto_type v_trs_7 = s7->u.C_Parse__Written.f_trans; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o8 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Ok))); o8->tag = 0; o8->u.C_Parse__Ok.f_v = v_trs_7; o8->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o8; }); }) : ({ __auto_type v_l_7 = s7->u.C_Parse__ByRel.f_line; __auto_type v_r_8 = s7->u.C_Parse__ByRel.f_rel; ({ __auto_type s9 = f_Parse__relPairs(p_eff__Region, p_rels, v_r_8); s9->tag == 1 ? ({ __auto_type v_trs_9 = s9->u.C_Coll__Some.f_v; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o10 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Ok))); o10->tag = 0; o10->u.C_Parse__Ok.f_v = v_trs_9; o10->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o10; }); }) : ({ ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o9 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"a transition of this capability", 31}); o9; }); }); }); }); }); __auto_type res_ = ({ __auto_type s8 = v_rt_7; s8->tag == 1 ? ({ __auto_type v_l_8 = s8->u.C_Parse__Err.f_line; __auto_type v_w_9 = s8->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Op* o10 = (struct E_Parse__R__Coll__List_1_Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Op, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Op*)0)->u.C_Parse__Err))); o10->tag = 1; o10->u.C_Parse__Err.f_line = v_l_8; o10->u.C_Parse__Err.f_want = v_w_9; o10; }); }) : ({ __auto_type v_trs_8 = s8->u.C_Parse__Ok.f_v; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Parse__COp* t1 = v_rest_1; struct E_Coll__List__Sym__Sym* t2 = p_ss; struct E_Coll__List__Parse__Rel* t3 = p_rels; struct E_Coll__List__Ast__Op* t4 = ({ struct E_Coll__List__Ast__Op* o9 = (struct E_Coll__List__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Op, u) + sizeof(((struct E_Coll__List__Ast__Op*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = ({ struct E_Ast__Op* o9 = (struct E_Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Op, u) + sizeof(((struct E_Ast__Op*)0)->u.C_Ast__Op))); o9->tag = 0; o9->u.C_Ast__Op.f_line = v_line_2; o9->u.C_Ast__Op.f_name = v_name_3; o9->u.C_Ast__Op.f_params = v_ps_4; o9->u.C_Ast__Op.f_ret = v_ret_5; o9->u.C_Ast__Op.f_trans = v_trs_8; o9; }); o9->u.C_Coll__Cons.f_t = p_acc; o9; }); p_eff__Region = t0; p_os = t1; p_ss = t2; p_rels = t3; p_acc = t4; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Op*){0}; }); }); }); res_; }); }); }); res_; }); }); }); } +static struct E_Coll__List__Ast__Op* f_Coll__rev__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs) { return f_Coll__revOnto__Ast__Op(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__Op)); } +static struct E_Coll__List__Ast__Op* f_Coll__revOnto__Ast__Op(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Op* p_xs, struct E_Coll__List__Ast__Op* p_acc) { srs_tail: return ({ __auto_type s0 = p_xs; s0->tag == 0 ? ({ p_acc; }) : ({ __auto_type v_h_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_t_1 = s0->u.C_Coll__Cons.f_t; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Ast__Op* t1 = v_t_1; struct E_Coll__List__Ast__Op* t2 = ({ struct E_Coll__List__Ast__Op* o2 = (struct E_Coll__List__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Op, u) + sizeof(((struct E_Coll__List__Ast__Op*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = v_h_0; o2->u.C_Coll__Cons.f_t = p_acc; o2; }); p_eff__Region = t0; p_xs = t1; p_acc = t2; goto srs_tail; (struct E_Coll__List__Ast__Op*){0}; }); }); }); } +static struct E_Coll__List__Ast__Trans* f_Parse__stays(srs_cap* p_eff__Region, struct E_Coll__List__Sym__Sym* p_ss) { return ({ __auto_type s0 = p_ss; s0->tag == 0 ? ({ (&N_Coll__Nil__Ast__Trans); }) : ({ __auto_type v_s_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ struct E_Coll__List__Ast__Trans* o2 = (struct E_Coll__List__Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Trans, u) + sizeof(((struct E_Coll__List__Ast__Trans*)0)->u.C_Coll__Cons))); o2->tag = 1; o2->u.C_Coll__Cons.f_h = ({ struct E_Ast__Trans* o2 = (struct E_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Trans, u) + sizeof(((struct E_Ast__Trans*)0)->u.C_Ast__Trans))); o2->tag = 0; o2->u.C_Ast__Trans.f_from = v_s_0; o2->u.C_Ast__Trans.f_to = v_s_0; o2; }); o2->u.C_Coll__Cons.f_t = f_Parse__stays(p_eff__Region, v_rest_1); o2; }); }); }); } +static struct E_Coll__Option__Coll__List_1_Ast__Trans* f_Parse__relPairs(srs_cap* p_eff__Region, struct E_Coll__List__Parse__Rel* p_rels, struct E_Sym__Sym* p_r) { srs_tail: return ({ __auto_type s0 = p_rels; s0->tag == 0 ? ({ (&N_Coll__None__Coll__List_1_Ast__Trans); }) : ({ __auto_type v_x_0 = s0->u.C_Coll__Cons.f_h; __auto_type v_rest_1 = s0->u.C_Coll__Cons.f_t; ({ __auto_type res_ = ({ __auto_type s2 = v_x_0; ({ __auto_type v_n_2 = s2->u.C_Parse__Rel.f_name; __auto_type v_prs_3 = s2->u.C_Parse__Rel.f_pairs; ({ __auto_type res_ = (f_Sym__eq(v_n_2, p_r) ? ({ struct E_Coll__Option__Coll__List_1_Ast__Trans* o4 = (struct E_Coll__Option__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__Option__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Coll__Option__Coll__List_1_Ast__Trans*)0)->u.C_Coll__Some))); o4->tag = 1; o4->u.C_Coll__Some.f_v = v_prs_3; o4; }) : ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Parse__Rel* t1 = v_rest_1; struct E_Sym__Sym* t2 = p_r; p_eff__Region = t0; p_rels = t1; p_r = t2; goto srs_tail; (struct E_Coll__Option__Coll__List_1_Ast__Trans*){0}; })); res_; }); }); }); res_; }); }); }); } +static struct E_Parse__R__Parse__Pr* f_Parse__items(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Parse__Pr* p_pr) { srs_tail: return ({ __auto_type res_ = ({ __auto_type s0 = p_pr; ({ __auto_type v_ss_0 = s0->u.C_Parse__Pr.f_states; __auto_type v_st_1 = s0->u.C_Parse__Pr.f_start; __auto_type v_es_2 = s0->u.C_Parse__Pr.f_ends; __auto_type v_dr_3 = s0->u.C_Parse__Pr.f_drop; __auto_type v_os_4 = s0->u.C_Parse__Pr.f_ops; __auto_type v_rs_5 = s0->u.C_Parse__Pr.f_rules; __auto_type v_rels_6 = s0->u.C_Parse__Pr.f_rels; ({ __auto_type res_ = (f_Parse__isDedent(p_eff__Region, p_ts) ? ({ struct E_Parse__R__Parse__Pr* o7 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Ok))); o7->tag = 0; o7->u.C_Parse__Ok.f_v = p_pr; o7->u.C_Parse__Ok.f_ts = f_Parse__next(p_ts); o7; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"state", 5})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__nameLine(p_eff__Region, f_Parse__next(p_ts), (&N_Coll__Nil__Sym__Sym)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_xs_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o9 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o9->tag = 0; o9->u.C_Parse__Pr.f_states = v_xs_7; o9->u.C_Parse__Pr.f_start = v_st_1; o9->u.C_Parse__Pr.f_ends = v_es_2; o9->u.C_Parse__Pr.f_drop = v_dr_3; o9->u.C_Parse__Pr.f_ops = v_os_4; o9->u.C_Parse__Pr.f_rules = v_rs_5; o9->u.C_Parse__Pr.f_rels = v_rels_6; o9; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"start", 5})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_x_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o9 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o9->tag = 0; o9->u.C_Parse__Pr.f_states = v_ss_0; o9->u.C_Parse__Pr.f_start = v_x_7; o9->u.C_Parse__Pr.f_ends = v_es_2; o9->u.C_Parse__Pr.f_drop = v_dr_3; o9->u.C_Parse__Pr.f_ops = v_os_4; o9->u.C_Parse__Pr.f_rules = v_rs_5; o9->u.C_Parse__Pr.f_rels = v_rels_6; o9; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : ((f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"stop", 4})) || f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"end", 3}))) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__nameLine(p_eff__Region, f_Parse__next(p_ts), (&N_Coll__Nil__Sym__Sym)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_xs_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o9 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o9->tag = 0; o9->u.C_Parse__Pr.f_states = v_ss_0; o9->u.C_Parse__Pr.f_start = v_st_1; o9->u.C_Parse__Pr.f_ends = v_xs_7; o9->u.C_Parse__Pr.f_drop = v_dr_3; o9->u.C_Parse__Pr.f_ops = v_os_4; o9->u.C_Parse__Pr.f_rules = v_rs_5; o9->u.C_Parse__Pr.f_rels = v_rels_6; o9; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"drop", 4})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_x_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o9 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o9->tag = 0; o9->u.C_Parse__Pr.f_states = v_ss_0; o9->u.C_Parse__Pr.f_start = v_st_1; o9->u.C_Parse__Pr.f_ends = v_es_2; o9->u.C_Parse__Pr.f_drop = ({ struct E_Coll__Option__Sym__Sym* o9 = (struct E_Coll__Option__Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__Option__Sym__Sym, u) + sizeof(((struct E_Coll__Option__Sym__Sym*)0)->u.C_Coll__Some))); o9->tag = 1; o9->u.C_Coll__Some.f_v = v_x_7; o9; }); o9->u.C_Parse__Pr.f_ops = v_os_4; o9->u.C_Parse__Pr.f_rules = v_rs_5; o9->u.C_Parse__Pr.f_rels = v_rels_6; o9; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"transition", 10})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_r_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ __auto_type s9 = f_Parse__trans(p_eff__Region, v_t1_8, (&N_Coll__Nil__Ast__Trans)); s9->tag == 1 ? ({ __auto_type v_l_9 = s9->u.C_Parse__Err.f_line; __auto_type v_w_10 = s9->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o11 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o11->tag = 1; o11->u.C_Parse__Err.f_line = v_l_9; o11->u.C_Parse__Err.f_want = v_w_10; o11; }); }) : ({ __auto_type v_prs_9 = s9->u.C_Parse__Ok.f_v; __auto_type v_t2_10 = s9->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t2_10); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o11 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o11->tag = 0; o11->u.C_Parse__Pr.f_states = v_ss_0; o11->u.C_Parse__Pr.f_start = v_st_1; o11->u.C_Parse__Pr.f_ends = v_es_2; o11->u.C_Parse__Pr.f_drop = v_dr_3; o11->u.C_Parse__Pr.f_ops = v_os_4; o11->u.C_Parse__Pr.f_rules = v_rs_5; o11->u.C_Parse__Pr.f_rels = ({ struct E_Coll__List__Parse__Rel* o11 = (struct E_Coll__List__Parse__Rel*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Parse__Rel, u) + sizeof(((struct E_Coll__List__Parse__Rel*)0)->u.C_Coll__Cons))); o11->tag = 1; o11->u.C_Coll__Cons.f_h = ({ struct E_Parse__Rel* o11 = (struct E_Parse__Rel*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Rel, u) + sizeof(((struct E_Parse__Rel*)0)->u.C_Parse__Rel))); o11->tag = 0; o11->u.C_Parse__Rel.f_name = v_r_7; o11->u.C_Parse__Rel.f_pairs = v_prs_9; o11; }); o11->u.C_Coll__Cons.f_t = v_rels_6; o11; }); o11; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"def", 3})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__capDef(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_o_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o9 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o9->tag = 0; o9->u.C_Parse__Pr.f_states = v_ss_0; o9->u.C_Parse__Pr.f_start = v_st_1; o9->u.C_Parse__Pr.f_ends = v_es_2; o9->u.C_Parse__Pr.f_drop = v_dr_3; o9->u.C_Parse__Pr.f_ops = ({ struct E_Coll__List__Parse__COp* o9 = (struct E_Coll__List__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Parse__COp, u) + sizeof(((struct E_Coll__List__Parse__COp*)0)->u.C_Coll__Cons))); o9->tag = 1; o9->u.C_Coll__Cons.f_h = v_o_7; o9->u.C_Coll__Cons.f_t = v_os_4; o9; }); o9->u.C_Parse__Pr.f_rules = v_rs_5; o9->u.C_Parse__Pr.f_rels = v_rels_6; o9; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"op", 2})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__opDecl(p_eff__Region, f_Parse__next(p_ts), f_Parse__line(p_eff__Region, p_ts)); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_o_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t1_8 = s7->u.C_Parse__Ok.f_ts; ({ __auto_type res_ = ({ __auto_type s9 = v_o_7; ({ __auto_type v_ol_9 = s9->u.C_Ast__Op.f_line; __auto_type v_on_10 = s9->u.C_Ast__Op.f_name; __auto_type v_ops_11 = s9->u.C_Ast__Op.f_params; __auto_type v_oret_12 = s9->u.C_Ast__Op.f_ret; __auto_type v_otrs_13 = s9->u.C_Ast__Op.f_trans; ({ __auto_type res_ = ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t1_8); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o14 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o14->tag = 0; o14->u.C_Parse__Pr.f_states = v_ss_0; o14->u.C_Parse__Pr.f_start = v_st_1; o14->u.C_Parse__Pr.f_ends = v_es_2; o14->u.C_Parse__Pr.f_drop = v_dr_3; o14->u.C_Parse__Pr.f_ops = ({ struct E_Coll__List__Parse__COp* o14 = (struct E_Coll__List__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Parse__COp, u) + sizeof(((struct E_Coll__List__Parse__COp*)0)->u.C_Coll__Cons))); o14->tag = 1; o14->u.C_Coll__Cons.f_h = ({ struct E_Parse__COp* o14 = (struct E_Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__COp, u) + sizeof(((struct E_Parse__COp*)0)->u.C_Parse__COp))); o14->tag = 0; o14->u.C_Parse__COp.f_line = v_ol_9; o14->u.C_Parse__COp.f_name = v_on_10; o14->u.C_Parse__COp.f_params = v_ops_11; o14->u.C_Parse__COp.f_ret = v_oret_12; o14->u.C_Parse__COp.f_moves = ({ struct E_Parse__Moves* o14 = (struct E_Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Moves, u) + sizeof(((struct E_Parse__Moves*)0)->u.C_Parse__Written))); o14->tag = 3; o14->u.C_Parse__Written.f_trans = v_otrs_13; o14; }); o14; }); o14->u.C_Coll__Cons.f_t = v_os_4; o14; }); o14->u.C_Parse__Pr.f_rules = v_rs_5; o14->u.C_Parse__Pr.f_rels = v_rels_6; o14; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); res_; }); }); }); res_; }); }); }); res_; }) : (f_Parse__isKw(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"rule", 4})) ? ({ __auto_type res_ = ({ __auto_type s7 = f_Parse__kw(p_eff__Region, f_Parse__next(p_ts), ((srs_str){(const uint8_t*)"def", 3})); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o9 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_t1_7 = s7->u.C_Parse__Ok.f_ts; ({ __auto_type s8 = f_Parse__ruleDecl(p_eff__Region, v_t1_7, f_Parse__line(p_eff__Region, p_ts)); s8->tag == 1 ? ({ __auto_type v_l_8 = s8->u.C_Parse__Err.f_line; __auto_type v_w_9 = s8->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Pr* o10 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o10->tag = 1; o10->u.C_Parse__Err.f_line = v_l_8; o10->u.C_Parse__Err.f_want = v_w_9; o10; }); }) : ({ __auto_type v_rd_8 = s8->u.C_Parse__Ok.f_v; __auto_type v_t2_9 = s8->u.C_Parse__Ok.f_ts; ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__endLine(p_eff__Region, v_t2_9); struct E_Parse__Pr* t2 = ({ struct E_Parse__Pr* o10 = (struct E_Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Pr, u) + sizeof(((struct E_Parse__Pr*)0)->u.C_Parse__Pr))); o10->tag = 0; o10->u.C_Parse__Pr.f_states = v_ss_0; o10->u.C_Parse__Pr.f_start = v_st_1; o10->u.C_Parse__Pr.f_ends = v_es_2; o10->u.C_Parse__Pr.f_drop = v_dr_3; o10->u.C_Parse__Pr.f_ops = v_os_4; o10->u.C_Parse__Pr.f_rules = ({ struct E_Coll__List__Ast__RuleDef* o10 = (struct E_Coll__List__Ast__RuleDef*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__RuleDef, u) + sizeof(((struct E_Coll__List__Ast__RuleDef*)0)->u.C_Coll__Cons))); o10->tag = 1; o10->u.C_Coll__Cons.f_h = v_rd_8; o10->u.C_Coll__Cons.f_t = v_rs_5; o10; }); o10->u.C_Parse__Pr.f_rels = v_rels_6; o10; }); p_eff__Region = t0; p_ts = t1; p_pr = t2; goto srs_tail; (struct E_Parse__R__Parse__Pr*){0}; }); }); }); }); }); res_; }) : ({ struct E_Parse__R__Parse__Pr* o7 = (struct E_Parse__R__Parse__Pr*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Pr, u) + sizeof(((struct E_Parse__R__Parse__Pr*)0)->u.C_Parse__Err))); o7->tag = 1; o7->u.C_Parse__Err.f_line = f_Parse__line(p_eff__Region, p_ts); o7->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"capability item", 15}); o7; })))))))))); res_; }); }); }); res_; }); } +static struct E_Parse__R__Parse__COp* f_Parse__capDef(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o2 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_name_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__entry(p_eff__Region, v_t1_1); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o4 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_en_2 = s2->u.C_Parse__Ok.f_v; __auto_type v_t2_3 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s4 = f_Parse__params(p_eff__Region, v_t2_3); s4->tag == 1 ? ({ __auto_type v_l_4 = s4->u.C_Parse__Err.f_line; __auto_type v_w_5 = s4->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o6 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = v_l_4; o6->u.C_Parse__Err.f_want = v_w_5; o6; }); }) : ({ __auto_type v_ps_4 = s4->u.C_Parse__Ok.f_v; __auto_type v_t3_5 = s4->u.C_Parse__Ok.f_ts; ({ __auto_type s6 = f_Parse__op(p_eff__Region, v_t3_5, ((srs_str){(const uint8_t*)":", 1})); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o8 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_t4_6 = s6->u.C_Parse__Ok.f_ts; ({ __auto_type s7 = f_Parse__ty(p_eff__Region, v_t4_6); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o9 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_ret_7 = s7->u.C_Parse__Ok.f_v; __auto_type v_t5_8 = s7->u.C_Parse__Ok.f_ts; ({ __auto_type s9 = f_Parse__exitState(p_eff__Region, v_t5_8); s9->tag == 1 ? ({ __auto_type v_l_9 = s9->u.C_Parse__Err.f_line; __auto_type v_w_10 = s9->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o11 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o11->tag = 1; o11->u.C_Parse__Err.f_line = v_l_9; o11->u.C_Parse__Err.f_want = v_w_10; o11; }); }) : ({ __auto_type v_ex_9 = s9->u.C_Parse__Ok.f_v; __auto_type v_t6_10 = s9->u.C_Parse__Ok.f_ts; ({ __auto_type s11 = f_Parse__moves(p_eff__Region, p_line, v_en_2, v_ex_9); s11->tag == 1 ? ({ __auto_type v_l_11 = s11->u.C_Parse__Err.f_line; __auto_type v_w_12 = s11->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__COp* o13 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Err))); o13->tag = 1; o13->u.C_Parse__Err.f_line = v_l_11; o13->u.C_Parse__Err.f_want = v_w_12; o13; }); }) : ({ __auto_type v_mv_11 = s11->u.C_Parse__Ok.f_v; ({ struct E_Parse__R__Parse__COp* o12 = (struct E_Parse__R__Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__COp, u) + sizeof(((struct E_Parse__R__Parse__COp*)0)->u.C_Parse__Ok))); o12->tag = 0; o12->u.C_Parse__Ok.f_v = ({ struct E_Parse__COp* o12 = (struct E_Parse__COp*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__COp, u) + sizeof(((struct E_Parse__COp*)0)->u.C_Parse__COp))); o12->tag = 0; o12->u.C_Parse__COp.f_line = p_line; o12->u.C_Parse__COp.f_name = v_name_0; o12->u.C_Parse__COp.f_params = v_ps_4; o12->u.C_Parse__COp.f_ret = v_ret_7; o12->u.C_Parse__COp.f_moves = v_mv_11; o12; }); o12->u.C_Parse__Ok.f_ts = v_t6_10; o12; }); }); }); }); }); }); }); }); }); }); }); }); }); }); }); } +static struct E_Parse__R__Parse__Entry* f_Parse__entry(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"<", 1})) ? ({ __auto_type s0 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Entry* o2 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_a_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)">", 1})) ? ({ struct E_Parse__R__Parse__Entry* o2 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Ok))); o2->tag = 0; o2->u.C_Parse__Ok.f_v = ({ struct E_Parse__Entry* o2 = (struct E_Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Entry, u) + sizeof(((struct E_Parse__Entry*)0)->u.C_Parse__EState))); o2->tag = 1; o2->u.C_Parse__EState.f_s = v_a_0; o2; }); o2->u.C_Parse__Ok.f_ts = f_Parse__next(v_t1_1); o2; }) : ({ __auto_type s2 = f_Parse__ident(p_eff__Region, v_t1_1); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Entry* o4 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_r_2 = s2->u.C_Parse__Ok.f_v; __auto_type v_t2_3 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s4 = f_Parse__ident(p_eff__Region, v_t2_3); s4->tag == 1 ? ({ __auto_type v_l_4 = s4->u.C_Parse__Err.f_line; __auto_type v_w_5 = s4->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Entry* o6 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = v_l_4; o6->u.C_Parse__Err.f_want = v_w_5; o6; }); }) : ({ __auto_type v_b_4 = s4->u.C_Parse__Ok.f_v; __auto_type v_t3_5 = s4->u.C_Parse__Ok.f_ts; ({ __auto_type s6 = f_Parse__op(p_eff__Region, v_t3_5, ((srs_str){(const uint8_t*)">", 1})); s6->tag == 1 ? ({ __auto_type v_l_6 = s6->u.C_Parse__Err.f_line; __auto_type v_w_7 = s6->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Parse__Entry* o8 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Err))); o8->tag = 1; o8->u.C_Parse__Err.f_line = v_l_6; o8->u.C_Parse__Err.f_want = v_w_7; o8; }); }) : ({ __auto_type v_t4_6 = s6->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Parse__Entry* o7 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Ok))); o7->tag = 0; o7->u.C_Parse__Ok.f_v = ({ struct E_Parse__Entry* o7 = (struct E_Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Entry, u) + sizeof(((struct E_Parse__Entry*)0)->u.C_Parse__ERel))); o7->tag = 2; o7->u.C_Parse__ERel.f_s = v_a_0; o7->u.C_Parse__ERel.f_r = v_r_2; o7->u.C_Parse__ERel.f_t = v_b_4; o7; }); o7->u.C_Parse__Ok.f_ts = v_t4_6; o7; }); }); }); }); }); }); })); res_; }); }); }) : ({ struct E_Parse__R__Parse__Entry* o0 = (struct E_Parse__R__Parse__Entry*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Entry, u) + sizeof(((struct E_Parse__R__Parse__Entry*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = (&N_Parse__ENone); o0->u.C_Parse__Ok.f_ts = p_ts; o0; })); res_; }); } +static struct E_Parse__R__Coll__Option_1_Sym__Sym* f_Parse__exitState(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts) { return ({ __auto_type res_ = (f_Parse__isOp(p_eff__Region, p_ts, ((srs_str){(const uint8_t*)"<", 1})) ? ({ __auto_type s0 = f_Parse__ident(p_eff__Region, f_Parse__next(p_ts)); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__Option_1_Sym__Sym* o2 = (struct E_Parse__R__Coll__Option_1_Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__Option_1_Sym__Sym, u) + sizeof(((struct E_Parse__R__Coll__Option_1_Sym__Sym*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_b_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__op(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)">", 1})); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__Option_1_Sym__Sym* o4 = (struct E_Parse__R__Coll__Option_1_Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__Option_1_Sym__Sym, u) + sizeof(((struct E_Parse__R__Coll__Option_1_Sym__Sym*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_t2_2 = s2->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Coll__Option_1_Sym__Sym* o3 = (struct E_Parse__R__Coll__Option_1_Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__Option_1_Sym__Sym, u) + sizeof(((struct E_Parse__R__Coll__Option_1_Sym__Sym*)0)->u.C_Parse__Ok))); o3->tag = 0; o3->u.C_Parse__Ok.f_v = ({ struct E_Coll__Option__Sym__Sym* o3 = (struct E_Coll__Option__Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__Option__Sym__Sym, u) + sizeof(((struct E_Coll__Option__Sym__Sym*)0)->u.C_Coll__Some))); o3->tag = 1; o3->u.C_Coll__Some.f_v = v_b_0; o3; }); o3->u.C_Parse__Ok.f_ts = v_t2_2; o3; }); }); }); }); }) : ({ struct E_Parse__R__Coll__Option_1_Sym__Sym* o0 = (struct E_Parse__R__Coll__Option_1_Sym__Sym*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__Option_1_Sym__Sym, u) + sizeof(((struct E_Parse__R__Coll__Option_1_Sym__Sym*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = (&N_Coll__None__Sym__Sym); o0->u.C_Parse__Ok.f_ts = p_ts; o0; })); res_; }); } +static struct E_Parse__R__Parse__Moves* f_Parse__moves(srs_cap* p_eff__Region, int64_t p_line, struct E_Parse__Entry* p_en, struct E_Coll__Option__Sym__Sym* p_ex) { return ({ __auto_type s0 = p_en; s0->tag == 0 ? ({ ({ __auto_type s0 = p_ex; s0->tag == 0 ? ({ ({ struct E_Parse__R__Parse__Moves* o0 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Ok))); o0->tag = 0; o0->u.C_Parse__Ok.f_v = (&N_Parse__Stay); o0->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o0; }); }) : ({ ({ struct E_Parse__R__Parse__Moves* o0 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Err))); o0->tag = 1; o0->u.C_Parse__Err.f_line = p_line; o0->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"an entry state for the exit state", 37}); o0; }); }); }); }) : s0->tag == 1 ? ({ __auto_type v_a_0 = s0->u.C_Parse__EState.f_s; ({ __auto_type s1 = p_ex; s1->tag == 1 ? ({ __auto_type v_b_1 = s1->u.C_Coll__Some.f_v; ({ struct E_Parse__R__Parse__Moves* o2 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Ok))); o2->tag = 0; o2->u.C_Parse__Ok.f_v = ({ struct E_Parse__Moves* o2 = (struct E_Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Moves, u) + sizeof(((struct E_Parse__Moves*)0)->u.C_Parse__Move))); o2->tag = 1; o2->u.C_Parse__Move.f_from = v_a_0; o2->u.C_Parse__Move.f_to = v_b_1; o2; }); o2->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o2; }); }) : ({ ({ struct E_Parse__R__Parse__Moves* o1 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Err))); o1->tag = 1; o1->u.C_Parse__Err.f_line = p_line; o1->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"an exit state ", 17}); o1; }); }); }); }) : ({ __auto_type v_r_0 = s0->u.C_Parse__ERel.f_r; __auto_type v_t_1 = s0->u.C_Parse__ERel.f_t; ({ __auto_type s2 = p_ex; s2->tag == 1 ? ({ __auto_type v_b_2 = s2->u.C_Coll__Some.f_v; (f_Sym__eq(v_b_2, v_t_1) ? ({ struct E_Parse__R__Parse__Moves* o3 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Ok))); o3->tag = 0; o3->u.C_Parse__Ok.f_v = ({ struct E_Parse__Moves* o3 = (struct E_Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__Moves, u) + sizeof(((struct E_Parse__Moves*)0)->u.C_Parse__ByRel))); o3->tag = 2; o3->u.C_Parse__ByRel.f_line = p_line; o3->u.C_Parse__ByRel.f_rel = v_r_0; o3; }); o3->u.C_Parse__Ok.f_ts = (&N_Coll__Nil__Lex__Tok); o3; }) : ({ struct E_Parse__R__Parse__Moves* o3 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Err))); o3->tag = 1; o3->u.C_Parse__Err.f_line = p_line; o3->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"the exit of ", 23}); o3; })); }) : ({ ({ struct E_Parse__R__Parse__Moves* o2 = (struct E_Parse__R__Parse__Moves*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Parse__Moves, u) + sizeof(((struct E_Parse__R__Parse__Moves*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = p_line; o2->u.C_Parse__Err.f_want = ((srs_str){(const uint8_t*)"the exit of ", 23}); o2; }); }); }); }); }); } static struct E_Parse__R__Ast__Op* f_Parse__opDecl(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, int64_t p_line) { return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Op* o2 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_name_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__params(p_eff__Region, v_t1_1); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Op* o4 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_ps_2 = s2->u.C_Parse__Ok.f_v; __auto_type v_t2_3 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s4 = f_Parse__op(p_eff__Region, v_t2_3, ((srs_str){(const uint8_t*)":", 1})); s4->tag == 1 ? ({ __auto_type v_l_4 = s4->u.C_Parse__Err.f_line; __auto_type v_w_5 = s4->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Op* o6 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = v_l_4; o6->u.C_Parse__Err.f_want = v_w_5; o6; }); }) : ({ __auto_type v_t3_4 = s4->u.C_Parse__Ok.f_ts; ({ __auto_type s5 = f_Parse__ty(p_eff__Region, v_t3_4); s5->tag == 1 ? ({ __auto_type v_l_5 = s5->u.C_Parse__Err.f_line; __auto_type v_w_6 = s5->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Op* o7 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Err))); o7->tag = 1; o7->u.C_Parse__Err.f_line = v_l_5; o7->u.C_Parse__Err.f_want = v_w_6; o7; }); }) : ({ __auto_type v_ret_5 = s5->u.C_Parse__Ok.f_v; __auto_type v_t4_6 = s5->u.C_Parse__Ok.f_ts; ({ __auto_type s7 = f_Parse__op(p_eff__Region, v_t4_6, ((srs_str){(const uint8_t*)":", 1})); s7->tag == 1 ? ({ __auto_type v_l_7 = s7->u.C_Parse__Err.f_line; __auto_type v_w_8 = s7->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Op* o9 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Err))); o9->tag = 1; o9->u.C_Parse__Err.f_line = v_l_7; o9->u.C_Parse__Err.f_want = v_w_8; o9; }); }) : ({ __auto_type v_t5_7 = s7->u.C_Parse__Ok.f_ts; ({ __auto_type s8 = f_Parse__trans(p_eff__Region, v_t5_7, (&N_Coll__Nil__Ast__Trans)); s8->tag == 1 ? ({ __auto_type v_l_8 = s8->u.C_Parse__Err.f_line; __auto_type v_w_9 = s8->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Ast__Op* o10 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Err))); o10->tag = 1; o10->u.C_Parse__Err.f_line = v_l_8; o10->u.C_Parse__Err.f_want = v_w_9; o10; }); }) : ({ __auto_type v_trs_8 = s8->u.C_Parse__Ok.f_v; __auto_type v_t6_9 = s8->u.C_Parse__Ok.f_ts; ({ struct E_Parse__R__Ast__Op* o10 = (struct E_Parse__R__Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Ast__Op, u) + sizeof(((struct E_Parse__R__Ast__Op*)0)->u.C_Parse__Ok))); o10->tag = 0; o10->u.C_Parse__Ok.f_v = ({ struct E_Ast__Op* o10 = (struct E_Ast__Op*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Op, u) + sizeof(((struct E_Ast__Op*)0)->u.C_Ast__Op))); o10->tag = 0; o10->u.C_Ast__Op.f_line = p_line; o10->u.C_Ast__Op.f_name = v_name_0; o10->u.C_Ast__Op.f_params = v_ps_2; o10->u.C_Ast__Op.f_ret = v_ret_5; o10->u.C_Ast__Op.f_trans = v_trs_8; o10; }); o10->u.C_Parse__Ok.f_ts = v_t6_9; o10; }); }); }); }); }); }); }); }); }); }); }); }); }); } static struct E_Parse__R__Coll__List_1_Ast__Trans* f_Parse__trans(srs_cap* p_eff__Region, struct E_Coll__List__Lex__Tok* p_ts, struct E_Coll__List__Ast__Trans* p_acc) { srs_tail: return ({ __auto_type s0 = f_Parse__ident(p_eff__Region, p_ts); s0->tag == 1 ? ({ __auto_type v_l_0 = s0->u.C_Parse__Err.f_line; __auto_type v_w_1 = s0->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o2 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Err))); o2->tag = 1; o2->u.C_Parse__Err.f_line = v_l_0; o2->u.C_Parse__Err.f_want = v_w_1; o2; }); }) : ({ __auto_type v_a_0 = s0->u.C_Parse__Ok.f_v; __auto_type v_t1_1 = s0->u.C_Parse__Ok.f_ts; ({ __auto_type s2 = f_Parse__op(p_eff__Region, v_t1_1, ((srs_str){(const uint8_t*)"-", 1})); s2->tag == 1 ? ({ __auto_type v_l_2 = s2->u.C_Parse__Err.f_line; __auto_type v_w_3 = s2->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o4 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Err))); o4->tag = 1; o4->u.C_Parse__Err.f_line = v_l_2; o4->u.C_Parse__Err.f_want = v_w_3; o4; }); }) : ({ __auto_type v_t2_2 = s2->u.C_Parse__Ok.f_ts; ({ __auto_type s3 = f_Parse__op(p_eff__Region, v_t2_2, ((srs_str){(const uint8_t*)">", 1})); s3->tag == 1 ? ({ __auto_type v_l_3 = s3->u.C_Parse__Err.f_line; __auto_type v_w_4 = s3->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o5 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Err))); o5->tag = 1; o5->u.C_Parse__Err.f_line = v_l_3; o5->u.C_Parse__Err.f_want = v_w_4; o5; }); }) : ({ __auto_type v_t3_3 = s3->u.C_Parse__Ok.f_ts; ({ __auto_type s4 = f_Parse__ident(p_eff__Region, v_t3_3); s4->tag == 1 ? ({ __auto_type v_l_4 = s4->u.C_Parse__Err.f_line; __auto_type v_w_5 = s4->u.C_Parse__Err.f_want; ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o6 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Err))); o6->tag = 1; o6->u.C_Parse__Err.f_line = v_l_4; o6->u.C_Parse__Err.f_want = v_w_5; o6; }); }) : ({ __auto_type v_b_4 = s4->u.C_Parse__Ok.f_v; __auto_type v_t4_5 = s4->u.C_Parse__Ok.f_ts; ({ struct E_Coll__List__Ast__Trans* v_acc2_6 = ({ struct E_Coll__List__Ast__Trans* o6 = (struct E_Coll__List__Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Coll__List__Ast__Trans, u) + sizeof(((struct E_Coll__List__Ast__Trans*)0)->u.C_Coll__Cons))); o6->tag = 1; o6->u.C_Coll__Cons.f_h = ({ struct E_Ast__Trans* o6 = (struct E_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Ast__Trans, u) + sizeof(((struct E_Ast__Trans*)0)->u.C_Ast__Trans))); o6->tag = 0; o6->u.C_Ast__Trans.f_from = v_a_0; o6->u.C_Ast__Trans.f_to = v_b_4; o6; }); o6->u.C_Coll__Cons.f_t = p_acc; o6; }); __auto_type res_ = (f_Parse__isOp(p_eff__Region, v_t4_5, ((srs_str){(const uint8_t*)",", 1})) ? ({ srs_cap* t0 = p_eff__Region; struct E_Coll__List__Lex__Tok* t1 = f_Parse__next(v_t4_5); struct E_Coll__List__Ast__Trans* t2 = v_acc2_6; p_eff__Region = t0; p_ts = t1; p_acc = t2; goto srs_tail; (struct E_Parse__R__Coll__List_1_Ast__Trans*){0}; }) : ({ struct E_Parse__R__Coll__List_1_Ast__Trans* o7 = (struct E_Parse__R__Coll__List_1_Ast__Trans*)srs_alloc(p_eff__Region, (int64_t)(offsetof(struct E_Parse__R__Coll__List_1_Ast__Trans, u) + sizeof(((struct E_Parse__R__Coll__List_1_Ast__Trans*)0)->u.C_Parse__Ok))); o7->tag = 0; o7->u.C_Parse__Ok.f_v = f_Coll__rev__Ast__Trans(p_eff__Region, v_acc2_6); o7->u.C_Parse__Ok.f_ts = v_t4_5; o7; })); res_; }); }); }); }); }); }); }); }); }); } static struct E_Coll__List__Ast__Trans* f_Coll__rev__Ast__Trans(srs_cap* p_eff__Region, struct E_Coll__List__Ast__Trans* p_xs) { return f_Coll__revOnto__Ast__Trans(p_eff__Region, p_xs, (&N_Coll__Nil__Ast__Trans)); } diff --git a/s2/parse.srs b/s2/parse.srs index c763e96b..9cdcb7ba 100644 --- a/s2/parse.srs +++ b/s2/parse.srs @@ -99,7 +99,7 @@ def Parse.decl(ts: Coll.List[Lex.Tok]): Parse.R[Ast.Decl] = case Parse.Err(l, w) => Parse.Err(l, w) case Parse.Ok(_, t1) => Parse.wrapFn(Parse.fn(t1, Parse.line(ts), Parse.FExtern)) else if Parse.isKw(ts, "enum") then Parse.enumDecl(Parse.next(ts), Parse.line(ts)) - else if Parse.isKw(ts, "protocol") then Parse.proto(Parse.next(ts), Parse.line(ts)) + else if Parse.isKw(ts, "capability") || Parse.isKw(ts, "protocol") then Parse.proto(Parse.next(ts), Parse.line(ts)) else if Parse.isKw(ts, "handler") then Parse.handler(Parse.next(ts), Parse.line(ts)) else if Parse.isKw(ts, "trait") then Parse.traitDecl(Parse.next(ts), Parse.line(ts)) else if Parse.isKw(ts, "given") then Parse.givenDecl(Parse.next(ts), Parse.line(ts)) @@ -369,13 +369,22 @@ def Parse.atoms(ts: Coll.List[Lex.Tok], acc: Coll.List[Ast.Atom]): Parse.R[Coll. case Parse.Err(l, w) => Parse.Err(l, w) case Parse.Ok(a, t1) => if Parse.isOp(t1, ",") then Parse.atoms(Parse.next(t1), Coll.Cons(a, acc)) else Parse.atoms(t1, Coll.Cons(a, acc)) +// rel(terms); x: T is at(x, T); a r b is r(a, b) and a r is r(a) (vic 2026-11-09) def Parse.atom(ts: Coll.List[Lex.Tok]): Parse.R[Ast.Atom] = Parse.ident(ts) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(rel, t1) => Parse.op(t1, "(") match - case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(_, t2) => Parse.terms(t2, Coll.Nil) match + case Parse.Ok(a, t1) => + val line = Parse.line(ts) + if Parse.isOp(t1, "(") then Parse.terms(Parse.next(t1), Coll.Nil) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(xs, t3) => Parse.Ok(Ast.Atom(line, a, xs), t3) + else if Parse.isOp(t1, ":") then Parse.ident(Parse.next(t1)) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(xs, t3) => Parse.Ok(Ast.Atom(Parse.line(ts), rel, xs), t3) + case Parse.Ok(s, t2) => Parse.Ok(Ast.Atom(line, Sym.of("at"), Coll.Cons(Ast.TName(a), Coll.Cons(Ast.TName(s), Coll.Nil))), t2) + else Parse.ident(t1) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(r, t2) => Parse.peek(t2) match + case Lex.TIdent(b, _) => Parse.Ok(Ast.Atom(line, r, Coll.Cons(Ast.TName(a), Coll.Cons(Ast.TName(Sym.of(b)), Coll.Nil))), Parse.next(t2)) + case _ => Parse.Ok(Ast.Atom(line, r, Coll.Cons(Ast.TName(a), Coll.Nil)), t2) def Parse.terms(ts: Coll.List[Lex.Tok], acc: Coll.List[Ast.Term]): Parse.R[Coll.List[Ast.Term]] = if Parse.isOp(ts, ")") then Parse.Ok(Coll.rev(acc), Parse.next(ts)) @@ -450,50 +459,171 @@ def Parse.cases(ts: Coll.List[Lex.Tok], acc: Coll.List[Ast.Case]): Parse.R[Coll. case Parse.Ok(fs, t3) => Parse.cases(Parse.endLine(t3), Coll.Cons(Ast.Case(line, name, fs), acc)) else Parse.cases(Parse.endLine(t2), Coll.Cons(Ast.Case(line, name, Coll.Nil), acc)) -// ── protocol: items until DED (state, start, end, drop, op, rule def) ── +// ── capability (vic 2026-11-09; protocol is its old name): items until DED (state, start, stop, drop, transition, def, +// rule def). no state line: one state Live. a def's moves resolve to transitions once every item is read ── enum Parse.Pr: - case Parse.Pr(states: Coll.List[Sym.Sym], start: Sym.Sym, ends: Coll.List[Sym.Sym], drop: Coll.Option[Sym.Sym], ops: Coll.List[Ast.Op], rules: Coll.List[Ast.RuleDef]) + case Parse.Pr(states: Coll.List[Sym.Sym], start: Sym.Sym, ends: Coll.List[Sym.Sym], drop: Coll.Option[Sym.Sym], ops: Coll.List[Parse.COp], rules: Coll.List[Ast.RuleDef], rels: Coll.List[Parse.Rel]) + +// transition r A -> B, ...: the pairs of relation r +enum Parse.Rel: + case Parse.Rel(name: Sym.Sym, pairs: Coll.List[Ast.Trans]) + +// how a def moves its subject: .. , .. , or no facts (each state stays); op: the old form, resolved +enum Parse.Moves: + case Parse.Stay + case Parse.Move(from: Sym.Sym, to: Sym.Sym) + case Parse.ByRel(line: I64, rel: Sym.Sym) + case Parse.Written(trans: Coll.List[Ast.Trans]) + +enum Parse.COp: + case Parse.COp(line: I64, name: Sym.Sym, params: Coll.List[Ast.Binder], ret: Ast.Ty, moves: Parse.Moves) def Parse.proto(ts: Coll.List[Lex.Tok], line: I64): Parse.R[Ast.Decl] = Parse.ident(ts) match case Parse.Err(l, w) => Parse.Err(l, w) case Parse.Ok(name, t1) => Parse.layoutOpen(t1) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(_, t2) => Parse.items(t2, Parse.Pr(Coll.Nil, Sym.of(""), Coll.Nil, Coll.None, Coll.Nil, Coll.Nil)) match + case Parse.Ok(_, t2) => Parse.items(t2, Parse.Pr(Coll.Nil, Sym.of(""), Coll.Nil, Coll.None, Coll.Nil, Coll.Nil, Coll.Nil)) match case Parse.Err(l, w) => Parse.Err(l, w) case Parse.Ok(pr, t3) => - val Parse.Pr(ss, st, es, dr, os, rs) = pr - Parse.Ok(Ast.DProto(Ast.Proto(line, name, ss, st, es, dr, Coll.rev(os), Coll.rev(rs))), t3) + val Parse.Pr(ss0, st0, es0, dr, os, rs, rels) = pr + val live = Coll.Cons(Sym.of("Live"), Coll.Nil) + val ss: Coll.List[Sym.Sym] = ss0 match + case Coll.Nil => live + case Coll.Cons(_, _) => ss0 + val st = ss0 match + case Coll.Nil => Sym.of("Live") + case Coll.Cons(_, _) => st0 + val es: Coll.List[Sym.Sym] = ss0 match + case Coll.Nil => live + case Coll.Cons(_, _) => es0 + Parse.resolveOps(Coll.rev(os), ss, rels, Coll.Nil) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(aos, _) => Parse.Ok(Ast.DProto(Ast.Proto(line, name, ss, st, es, dr, aos, Coll.rev(rs))), t3) + +def Parse.resolveOps(os: Coll.List[Parse.COp], ss: Coll.List[Sym.Sym], rels: Coll.List[Parse.Rel], acc: Coll.List[Ast.Op]): Parse.R[Coll.List[Ast.Op]] = os match + case Coll.Nil => Parse.Ok(Coll.rev(acc), Coll.Nil) + case Coll.Cons(o, rest) => + val Parse.COp(line, name, ps, ret, mv) = o + val rt: Parse.R[Coll.List[Ast.Trans]] = mv match + case Parse.Stay => Parse.Ok(Parse.stays(ss), Coll.Nil) + case Parse.Move(a, b) => Parse.Ok(Coll.Cons(Ast.Trans(a, b), Coll.Nil), Coll.Nil) + case Parse.Written(trs) => Parse.Ok(trs, Coll.Nil) + case Parse.ByRel(l, r) => Parse.relPairs(rels, r) match + case Coll.Some(trs) => Parse.Ok(trs, Coll.Nil) + case Coll.None => Parse.Err(l, "a transition of this capability") + rt match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(trs, _) => Parse.resolveOps(rest, ss, rels, Coll.Cons(Ast.Op(line, name, ps, ret, trs), acc)) + +def Parse.stays(ss: Coll.List[Sym.Sym]): Coll.List[Ast.Trans] = ss match + case Coll.Nil => Coll.Nil + case Coll.Cons(s, rest) => Coll.Cons(Ast.Trans(s, s), Parse.stays(rest)) + +def Parse.relPairs(rels: Coll.List[Parse.Rel], r: Sym.Sym): Coll.Option[Coll.List[Ast.Trans]] = rels match + case Coll.Nil => Coll.None + case Coll.Cons(x, rest) => + val Parse.Rel(n, prs) = x + if Sym.eq(n, r) then Coll.Some(prs) else Parse.relPairs(rest, r) def Parse.items(ts: Coll.List[Lex.Tok], pr: Parse.Pr): Parse.R[Parse.Pr] = - val Parse.Pr(ss, st, es, dr, os, rs) = pr + val Parse.Pr(ss, st, es, dr, os, rs, rels) = pr if Parse.isDedent(ts) then Parse.Ok(pr, Parse.next(ts)) else if Parse.isKw(ts, "state") then Parse.nameLine(Parse.next(ts), Coll.Nil) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(xs, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(xs, st, es, dr, os, rs)) + case Parse.Ok(xs, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(xs, st, es, dr, os, rs, rels)) else if Parse.isKw(ts, "start") then Parse.ident(Parse.next(ts)) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(x, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, x, es, dr, os, rs)) - else if Parse.isKw(ts, "end") then + case Parse.Ok(x, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, x, es, dr, os, rs, rels)) + else if Parse.isKw(ts, "stop") || Parse.isKw(ts, "end") then Parse.nameLine(Parse.next(ts), Coll.Nil) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(xs, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, xs, dr, os, rs)) + case Parse.Ok(xs, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, xs, dr, os, rs, rels)) else if Parse.isKw(ts, "drop") then Parse.ident(Parse.next(ts)) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(x, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, es, Coll.Some(x), os, rs)) + case Parse.Ok(x, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, es, Coll.Some(x), os, rs, rels)) + else if Parse.isKw(ts, "transition") then + Parse.ident(Parse.next(ts)) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(r, t1) => Parse.trans(t1, Coll.Nil) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(prs, t2) => Parse.items(Parse.endLine(t2), Parse.Pr(ss, st, es, dr, os, rs, Coll.Cons(Parse.Rel(r, prs), rels))) + else if Parse.isKw(ts, "def") then + Parse.capDef(Parse.next(ts), Parse.line(ts)) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(o, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, es, dr, Coll.Cons(o, os), rs, rels)) else if Parse.isKw(ts, "op") then Parse.opDecl(Parse.next(ts), Parse.line(ts)) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(o, t1) => Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, es, dr, Coll.Cons(o, os), rs)) + case Parse.Ok(o, t1) => + val Ast.Op(ol, on, ops, oret, otrs) = o + Parse.items(Parse.endLine(t1), Parse.Pr(ss, st, es, dr, Coll.Cons(Parse.COp(ol, on, ops, oret, Parse.Written(otrs)), os), rs, rels)) else if Parse.isKw(ts, "rule") then Parse.kw(Parse.next(ts), "def") match case Parse.Err(l, w) => Parse.Err(l, w) case Parse.Ok(_, t1) => Parse.ruleDecl(t1, Parse.line(ts)) match case Parse.Err(l, w) => Parse.Err(l, w) - case Parse.Ok(rd, t2) => Parse.items(Parse.endLine(t2), Parse.Pr(ss, st, es, dr, os, Coll.Cons(rd, rs))) - else Parse.Err(Parse.line(ts), "protocol item") + case Parse.Ok(rd, t2) => Parse.items(Parse.endLine(t2), Parse.Pr(ss, st, es, dr, os, Coll.Cons(rd, rs), rels)) + else Parse.Err(Parse.line(ts), "capability item") + +// def name [ | ] (params): ty [ | ] in a capability +def Parse.capDef(ts: Coll.List[Lex.Tok], line: I64): Parse.R[Parse.COp] = Parse.ident(ts) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(name, t1) => Parse.entry(t1) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(en, t2) => Parse.params(t2) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(ps, t3) => Parse.op(t3, ":") match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(_, t4) => Parse.ty(t4) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(ret, t5) => Parse.exitState(t5) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(ex, t6) => Parse.moves(line, en, ex) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(mv, _) => Parse.Ok(Parse.COp(line, name, ps, ret, mv), t6) + +// the entry facts of a capability def: none, (a state), or (s moves to t by relation r) +enum Parse.Entry: + case Parse.ENone + case Parse.EState(s: Sym.Sym) + case Parse.ERel(s: Sym.Sym, r: Sym.Sym, t: Sym.Sym) + +def Parse.entry(ts: Coll.List[Lex.Tok]): Parse.R[Parse.Entry] = + if Parse.isOp(ts, "<") then Parse.ident(Parse.next(ts)) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(a, t1) => + if Parse.isOp(t1, ">") then Parse.Ok(Parse.EState(a), Parse.next(t1)) + else Parse.ident(t1) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(r, t2) => Parse.ident(t2) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(b, t3) => Parse.op(t3, ">") match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(_, t4) => Parse.Ok(Parse.ERel(a, r, b), t4) + else Parse.Ok(Parse.ENone, ts) + +def Parse.exitState(ts: Coll.List[Lex.Tok]): Parse.R[Coll.Option[Sym.Sym]] = + if Parse.isOp(ts, "<") then Parse.ident(Parse.next(ts)) match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(b, t1) => Parse.op(t1, ">") match + case Parse.Err(l, w) => Parse.Err(l, w) + case Parse.Ok(_, t2) => Parse.Ok(Coll.Some(b), t2) + else Parse.Ok(Coll.None, ts) + +// .. moves A to B; .. moves by r (the exit is the relation's target); no facts: each state stays +def Parse.moves(line: I64, en: Parse.Entry, ex: Coll.Option[Sym.Sym]): Parse.R[Parse.Moves] = en match + case Parse.ENone => ex match + case Coll.None => Parse.Ok(Parse.Stay, Coll.Nil) + case Coll.Some(_) => Parse.Err(line, "an entry state for the exit state") + case Parse.EState(a) => ex match + case Coll.Some(b) => Parse.Ok(Parse.Move(a, b), Coll.Nil) + case Coll.None => Parse.Err(line, "an exit state ") + case Parse.ERel(_, r, t) => ex match + case Coll.Some(b) => if Sym.eq(b, t) then Parse.Ok(Parse.ByRel(line, r), Coll.Nil) else Parse.Err(line, "the exit of ") + case Coll.None => Parse.Err(line, "the exit of ") // op name(params): ty : A -> B, ... def Parse.opDecl(ts: Coll.List[Lex.Tok], line: I64): Parse.R[Ast.Op] = Parse.ident(ts) match diff --git a/tests/s2/neg/cap_norel.srs b/tests/s2/neg/cap_norel.srs new file mode 100644 index 00000000..5c964c06 --- /dev/null +++ b/tests/s2/neg/cap_norel.srs @@ -0,0 +1,10 @@ +// expect: error[parse] +// a def moves by a transition its capability declares +capability Door: + state Shut, Open + start Shut + stop Open + def knock (): I64 + +def main(): I64 = 0 +// expect: --> tests/s2/neg/cap_norel.srs:7 diff --git a/tests/s2/neg/cap_order.srs b/tests/s2/neg/cap_order.srs new file mode 100644 index 00000000..640537f0 --- /dev/null +++ b/tests/s2/neg/cap_order.srs @@ -0,0 +1,15 @@ +// expect: error[capability-not-ended] +// Lamp must stop On: leaving it Off breaks the protocol (the facts check is the same as with `protocol`) +capability Lamp: + state Off, On + start Off + stop On + def on (): Unit + +handler HLamp for Lamp: + def on(): Unit = () + +def main(): I64 = + handle l = HLamp() + 0 +// expect: --> tests/s2/neg/cap_order.srs:13 diff --git a/tests/s2/prog/capability.out b/tests/s2/prog/capability.out new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/tests/s2/prog/capability.out @@ -0,0 +1 @@ +9 diff --git a/tests/s2/prog/capability.srs b/tests/s2/prog/capability.srs new file mode 100644 index 00000000..e926b026 --- /dev/null +++ b/tests/s2/prog/capability.srs @@ -0,0 +1,53 @@ +// pass: capability syntax (vic 2026-11-09): transition relations, defs that move by them, .. , no states (one +// state Live, each def stays), and fn facts as x: T and a r b. same program as rules.srs, same output +capability Door: + state Shut, Open1, Open2, Gone + start Shut + stop Gone + transition knocks Shut -> Open1, Open1 -> Open2 + def knock (): I64 + def leave (): Unit + transition leaves Open1 -> Gone, Open2 -> Gone + rule def twoKnocks(s, s3) = next(s, knock, s2), next(s2, knock, s3) + rule def reach(s, t) = next(s, knock, t) + rule def reach(s, t) = next(s, knock, u), reach(u, t) + +capability Bell: + def ring(): I64 + +capability Lamp: + state Off, On + start Off + stop On + def on (): Unit + +handler HDoor for Door: + def knock(): I64 = 3 + def leave(): Unit = () + +handler HBell for Bell: + def ring(): I64 = 0 + +handler HLamp for Lamp: + def on(): Unit = () + +def knockTwice {d: Door} (): I64 = + val a = d.knock() + a + d.knock() + +def knockOnce {d: Door} (): I64 = d.knock() + +def main(): I64 = + handle io = Srs.Console() + handle b = HBell() + handle l = HLamp() + l.on() + handle d = HDoor() + val x = knockTwice() + d.leave() + handle e = HDoor() + val y = knockOnce{e}() + e.leave() + Console.printI64(x + y + b.ring() + b.ring()) + Console.print("\n") + 0