Struct decleration

This commit is contained in:
2026-04-14 02:58:51 +02:00
parent d04fd4d2b2
commit 00569da11d
4 changed files with 55 additions and 15 deletions
+8 -3
View File
@@ -13,14 +13,19 @@ inner_str = @{ (!"\"" ~ ANY)* }
// ================= TOP LEVEL =================
top_level = _{ import | function_decl }
top_level = _{ import | function_decl | struct_decl }
export = { "export"? }
import = { "import" ~ string_lit ~ ";" }
param_list = { param ~ ("," ~ param)* ~ ","? }
param = { identifier ~ ":" ~ type_expr }
param_list = { param ~ ("," ~ param)* ~ ","? }
param = { identifier ~ ":" ~ type_expr }
struct_decl = {
export ~ "struct" ~ identifier ~ "{" ~ param_list? ~ "}"
}
function_decl = {
export ~ "function" ~ identifier ~ "(" ~ param_list? ~ ")" ~ (":" ~ type_expr)? ~ block
}