diff options
Diffstat (limited to '')
-rw-r--r-- | doc/mylang.ebnf | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/doc/mylang.ebnf b/doc/mylang.ebnf index 406da5e..a28fe80 100644 --- a/doc/mylang.ebnf +++ b/doc/mylang.ebnf @@ -4,6 +4,7 @@ letter = lowercaseLetter | uppercaseLetter. digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9". nl = "\n". +nls = nl { nl }. ident = letter { letter | digit }. integer = digit { digit }. @@ -20,18 +21,14 @@ factor = "(" bool ")" | ident | integer | "true" | "false". ident_list = ident { "," ident }. expression_list = expression { "," expression }. -program = function { function }. -function = "fun" ident "[" [ ident_list ] "]" statements "end". +program = function { [ nls ] function }. +function = "fun" ident "[" [ ident_list ] "]" [ nls ] statements [ nls ] "end". statement = [ if_statement | while_statement | assign_statement | function_call | return_statement ]. -statements = statement { nl statement }. +statements = statement { nls statement }. -if_statement = "if" expression statements [ "else" statements ] "end". -while_statement = "while" expression statements "end". +if_statement = "if" expression [ nls ] statements [ nls ] [ "else" statements [ nls ] ] "end". +while_statement = "while" expression [ nls ] statements [ nls ] "end". return_statement = "@" expression. assign_statement = ident "=" expression. function_call = ident "[" [ expression_list ] "]". - - - - |