summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/mylang.ebnf13
1 files changed, 7 insertions, 6 deletions
diff --git a/doc/mylang.ebnf b/doc/mylang.ebnf
index a082007..6945557 100644
--- a/doc/mylang.ebnf
+++ b/doc/mylang.ebnf
@@ -19,15 +19,16 @@ factor = "(" bool ")" | ident | integer | "true" | "false".
ident_list = ident { "," ident }.
expression_list = expression { "," expression }.
+function_list = function { [ nl ] function }.
+statement_list = statement { nl statement }.
-program = function { [ nl ] function }.
-function = "fun" ident "[" [ ident_list ] "]" [ nl ] statements [ nl ] "end".
-
+function = "fun" ident "[" [ ident_list ] "]" [ nl ] statement_list [ nl ] "end".
statement = [ if_statement | while_statement | assign_statement | function_call | return_statement ].
-statements = statement { nl statement }.
-if_statement = "if" expression [ nl ] statements [ nl ] [ "else" statements [ nl ] ] "end".
-while_statement = "while" expression [ nl ] statements [ nl ] "end".
+if_statement = "if" expression [ nl ] statement_list [ nl ] [ "else" statement_list [ nl ] ] "end".
+while_statement = "while" expression [ nl ] statement_list [ nl ] "end".
return_statement = "@" expression.
assign_statement = ident "=" expression.
function_call = ident "[" [ expression_list ] "]".
+
+program = function_list.