diff options
author | JJ | 2023-10-26 22:04:37 +0000 |
---|---|---|
committer | JJ | 2023-10-26 22:06:51 +0000 |
commit | 2ea4fd4c09ad71c4ac648cf3645426476dd7521f (patch) | |
tree | c4bf3f7a4fd43a25508231ee21202bb3a573c8b2 /std | |
parent | 0609270d01b8f87e2c7579e91b43a6d0c2862f49 (diff) |
compiler: clean up the abstract syntax tree
Diffstat (limited to 'std')
-rw-r--r-- | std/fundamental/ast.pk | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/std/fundamental/ast.pk b/std/fundamental/ast.pk index 202c7d4..0529cbd 100644 --- a/std/fundamental/ast.pk +++ b/std/fundamental/ast.pk @@ -45,15 +45,15 @@ pub type Call = struct id: str params: list[Expr] pub type Cond = struct - branches: list[CondBranch] + branches: list[struct[cond: Expr, body: list[Expr]]] else_body: Option[list[Expr]] pub type Try = struct - body: ref Expr + body: list[Expr] catches: list[struct[exceptions: list[str], body: list[Expr]]] finally_body: Option[list[Expr]] pub type Match = struct item: ref Expr - branches: list[MatchBranch] + branches: list[struct[pattern: Pattern, guard: Option[Expr], body: list[Expr]]] pub type Block = struct id: Option[str] body: list[Expr] @@ -98,13 +98,6 @@ pub type Pattern = union Struct: struct[name: str, params: list[Pattern]] Tuple: list[Pattern] List: list[Pattern] -pub type CondBranch = struct - cond: Expr - body: list[Expr] -pub type MatchBranch = struct - pattern: Pattern - guard: Option[Expr] - body: Expr # the second style of union. A union of literal types, no names. pub type Expr = union |