From 0609270d01b8f87e2c7579e91b43a6d0c2862f49 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 26 Oct 2023 14:51:27 -0700 Subject: compiler: draft of the abstract syntax tree --- std/fundamental/ast.pk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'std') diff --git a/std/fundamental/ast.pk b/std/fundamental/ast.pk index 25bdc02..202c7d4 100644 --- a/std/fundamental/ast.pk +++ b/std/fundamental/ast.pk @@ -25,8 +25,8 @@ pub type FuncDecl = struct public: bool effect: Option[str] id: str - generics: list[struct[name: str, kind: Option[Type]]] - params: list[struct[name: str, kind: Type]] + generics: list[struct[id: str, kind: Option[Type]]] + params: list[struct[id: str, kind: Type]] kind: Type body: list[Expr] pub type TypeDecl = struct @@ -38,8 +38,8 @@ pub type Import = struct imports: list[str] alias: Option[str] pub type Module = struct - name: str - body: list[ref Expr] + id: str + body: list[Expr] pub type Call = struct id: str @@ -94,9 +94,10 @@ pub type Signature = struct # todo: generics kind: Option[Type] pub type Pattern = union Ident: str - Struct: struct[name: str, params: list[]] + Number: int, Float: float, Char: char, String: str + Struct: struct[name: str, params: list[Pattern]] Tuple: list[Pattern] - List + List: list[Pattern] pub type CondBranch = struct cond: Expr body: list[Expr] -- cgit v1.2.3-70-g09d2