summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-05-20 14:32:12 +0200
committerBenedikt Böhm <bb@xnull.de>2009-05-20 14:32:12 +0200
commitcc05d3b7e249ca9607667fde84fdf0c274cbb92c (patch)
tree300a3b0a46e2e2ddd9a915b906fcf8079eb31da8 /doc
parent614065172ad58893fa2eab25fdfe25d1aa21a483 (diff)
downloadswppy-cc05d3b7e249ca9607667fde84fdf0c274cbb92c.tar.gz
swppy-cc05d3b7e249ca9607667fde84fdf0c274cbb92c.tar.xz
swppy-cc05d3b7e249ca9607667fde84fdf0c274cbb92c.zip
make newlines explicit
Diffstat (limited to 'doc')
-rw-r--r--doc/mylang.ebnf15
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 ] "]".
-
-
-
-