summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-06-29 12:28:01 +0200
committerBenedikt Böhm <bb@xnull.de>2009-06-29 12:28:01 +0200
commit4aedc5d76250fae734af1cd89256ec70e165ab18 (patch)
tree9f9c290f7d31a9aa966045019972670382596d45 /doc
parent17fab2bc59945045a8df39ece8c845d1565245da (diff)
downloadswppy-4aedc5d76250fae734af1cd89256ec70e165ab18.tar.gz
swppy-4aedc5d76250fae734af1cd89256ec70e165ab18.tar.xz
swppy-4aedc5d76250fae734af1cd89256ec70e165ab18.zip
fix function_call
- function_call is now an expression and a statement - call keyword is required to make lookahead = 1 work
Diffstat (limited to 'doc')
-rw-r--r--doc/mylang.ebnf36
1 files changed, 18 insertions, 18 deletions
diff --git a/doc/mylang.ebnf b/doc/mylang.ebnf
index 7c67bbb..f84869f 100644
--- a/doc/mylang.ebnf
+++ b/doc/mylang.ebnf
@@ -8,27 +8,27 @@ nl = "\n".
ident = letter { letter | digit }.
integer = digit { digit }.
-disjunction = conjunction { "||" conjunction }.
-conjunction = boolean { "&&" boolean }.
-boolean = "!" disjunction | comparison | "(" disjunction ")" | "true" | "false".
-comparison = expression ( "==" | "!=" | "<" | "<=" | "=>" | ">" ) expression.
-
+boolean = join { "||" join }.
+join = relation { "&&" relation }.
+relation = expression { ( "==" | "!=" | "<" | "<=" | ">=" | ">" ) expression }.
expression = term { ( "+" | "-" ) term }.
term = unary { ( "*" | "/" | "%" ) unary }.
-unary = ident | integer | "-" unary | "(" expression ")".
+unary = "!" unary | "-" unary | factor.
+factor = "(" boolean ")" | ident | integer | "true" | "false" | function_call.
+
+function_call = "call" ident "[" [ expression_list ] "]".
ident_list = ident { "," ident }.
-expression_list = expression { "," expression }.
-function_list = function { nl function }.
-statement_list = statement { nl statement }.
-
-function = "fun" ident "[" [ ident_list ] "]" nl statement_list nl "end".
-statement = [ if_statement | while_statement | assign_statement | function_call | return_statement ].
-
-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 ] "]".
+expression_list = boolean { "," boolean }.
+function_list = function { function }.
+statement_list = statement { statement }.
+
+function = "fun" ident "[" [ ident_list ] "]" nl statement_list "end" nl.
+statement = ( if_statement | while_statement | assign_statement | return_statement | function_call ).
+
+if_statement = "if" boolean nl statement_list [ "else" nl statement_list ] "end" nl.
+while_statement = "while" boolean nl statement_list "end" nl.
+return_statement = "@" boolean nl.
+assign_statement = ident "=" boolean nl.
program = function_list.