summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-05-20 14:38:05 +0200
committerBenedikt Böhm <bb@xnull.de>2009-05-20 14:38:05 +0200
commit2d5e23737db901991504225688f1af4b7cdc2a41 (patch)
treebb70f13f150a51f85454b77d6206491772f94eb6
parentcc05d3b7e249ca9607667fde84fdf0c274cbb92c (diff)
downloadswppy-2d5e23737db901991504225688f1af4b7cdc2a41.tar.gz
swppy-2d5e23737db901991504225688f1af4b7cdc2a41.tar.xz
swppy-2d5e23737db901991504225688f1af4b7cdc2a41.zip
lexer combines multiple newlines already, so we ignore it in the grammar
-rw-r--r--doc/mylang.ebnf11
1 files changed, 5 insertions, 6 deletions
diff --git a/doc/mylang.ebnf b/doc/mylang.ebnf
index a28fe80..a082007 100644
--- a/doc/mylang.ebnf
+++ b/doc/mylang.ebnf
@@ -4,7 +4,6 @@ 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 }.
@@ -21,14 +20,14 @@ factor = "(" bool ")" | ident | integer | "true" | "false".
ident_list = ident { "," ident }.
expression_list = expression { "," expression }.
-program = function { [ nls ] function }.
-function = "fun" ident "[" [ ident_list ] "]" [ nls ] statements [ nls ] "end".
+program = function { [ nl ] function }.
+function = "fun" ident "[" [ ident_list ] "]" [ nl ] statements [ nl ] "end".
statement = [ if_statement | while_statement | assign_statement | function_call | return_statement ].
-statements = statement { nls statement }.
+statements = statement { nl statement }.
-if_statement = "if" expression [ nls ] statements [ nls ] [ "else" statements [ nls ] ] "end".
-while_statement = "while" expression [ nls ] statements [ nls ] "end".
+if_statement = "if" expression [ nl ] statements [ nl ] [ "else" statements [ nl ] ] "end".
+while_statement = "while" expression [ nl ] statements [ nl ] "end".
return_statement = "@" expression.
assign_statement = ident "=" expression.
function_call = ident "[" [ expression_list ] "]".