aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorJJ2023-10-26 21:51:27 +0000
committerJJ2023-10-26 21:51:27 +0000
commit0609270d01b8f87e2c7579e91b43a6d0c2862f49 (patch)
treedf1ea6516e4aa10ef4862ec8ebdb3717e5357f11 /std
parent0fa32e833237affd401ec644704cda4f84d07374 (diff)
compiler: draft of the abstract syntax tree
Diffstat (limited to 'std')
-rw-r--r--std/fundamental/ast.pk13
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]