Function prototypes

This commit is contained in:
2023-08-26 00:42:41 -05:00
parent 5bf5b7a78f
commit a7c7610105
4 changed files with 95 additions and 4 deletions
+3 -1
View File
@@ -80,7 +80,9 @@ block = { "{" ~ statement* ~ "}" }
function = { "fn" ~ name ~ argnames ~ block }
argnames = { "(" ~ (name ~ ("," ~ name)*)? ~ ")" }
declaration = { function | global | const_decl }
function_prototype = { "fn" ~ name ~ argnames ~ ";" }
declaration = { function | function_prototype | global | const_decl }
program = { (COMMENT | WHITESPACE)? ~ declaration* ~ EOI }
return_stmt = { "return" ~ expr? }