summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-05-21 16:40:21 +0200
committerBenedikt Böhm <bb@xnull.de>2009-05-21 16:40:21 +0200
commitccdf1686129f73765cf9b771c04f4676e0ad22bd (patch)
tree3a888fa6f3d457b4105eaab83616fdba1634a1bc
parent2d5e23737db901991504225688f1af4b7cdc2a41 (diff)
downloadswppy-ccdf1686129f73765cf9b771c04f4676e0ad22bd.tar.gz
swppy-ccdf1686129f73765cf9b771c04f4676e0ad22bd.tar.xz
swppy-ccdf1686129f73765cf9b771c04f4676e0ad22bd.zip
make syntax productions consistent
-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.