diff options
author | JJ | 2023-10-26 21:51:27 +0000 |
---|---|---|
committer | JJ | 2023-10-26 21:51:27 +0000 |
commit | 0609270d01b8f87e2c7579e91b43a6d0c2862f49 (patch) | |
tree | df1ea6516e4aa10ef4862ec8ebdb3717e5357f11 /std/fundamental | |
parent | 0fa32e833237affd401ec644704cda4f84d07374 (diff) |
compiler: draft of the abstract syntax tree
Diffstat (limited to 'std/fundamental')
-rw-r--r-- | std/fundamental/ast.pk | 13 |
1 files changed, 7 insertions, 6 deletions
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] |