From 2ea4fd4c09ad71c4ac648cf3645426476dd7521f Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 26 Oct 2023 15:04:37 -0700 Subject: compiler: clean up the abstract syntax tree --- std/fundamental/ast.pk | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'std') 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 -- cgit v1.2.3-70-g09d2