summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-05-19 17:29:15 +0200
committerBenedikt Böhm <bb@xnull.de>2009-05-19 17:29:15 +0200
commitb649933b98691a43e7e3adf158109ced285e802c (patch)
tree5b64d054d6af6bb1700d21c1b0a69d5dd39c8740 /doc
parentd461e639094b76242deaed91ff3b8cb645bbcf87 (diff)
downloadswppy-b649933b98691a43e7e3adf158109ced285e802c.tar.gz
swppy-b649933b98691a43e7e3adf158109ced285e802c.tar.xz
swppy-b649933b98691a43e7e3adf158109ced285e802c.zip
update ebnf
Diffstat (limited to 'doc')
-rw-r--r--doc/mylang.ebnf16
1 files changed, 10 insertions, 6 deletions
diff --git a/doc/mylang.ebnf b/doc/mylang.ebnf
index 53be3a4..406da5e 100644
--- a/doc/mylang.ebnf
+++ b/doc/mylang.ebnf
@@ -8,10 +8,14 @@ nl = "\n".
ident = letter { letter | digit }.
integer = digit { digit }.
-factor = ident | integer | "(" expression ")" | "~" factor.
-term = factor {("*" | "/" | "%" | "&&") factor}.
-simple_expression = ["+" | "-"] term {("+" | "-" | "||") term}.
-expression = simple_expression [ ( "==" | "!=" | ">=" | "<=" | ">" | "<" ) simple_expression ].
+bool = bool "||" join | join.
+join = join "&&" equality | equality.
+equality = equality "==" relation | equality "!=" relation | relation.
+relation = expression "<" expression | expression "<=" expression | expression ">=" expression | expression ">" expression | expression.
+expression = expression "+" term | expression "-" term | term.
+term = term "*" unary | term "/" unary | unary.
+unary = "!" unary | "-" unary | factor.
+factor = "(" bool ")" | ident | integer | "true" | "false".
ident_list = ident { "," ident }.
expression_list = expression { "," expression }.
@@ -19,13 +23,13 @@ expression_list = expression { "," expression }.
program = function { function }.
function = "fun" ident "[" [ ident_list ] "]" statements "end".
-statement = [ if_statement | while_statement | assignment | function_call | return_statement ].
+statement = [ if_statement | while_statement | assign_statement | function_call | return_statement ].
statements = statement { nl statement }.
if_statement = "if" expression statements [ "else" statements ] "end".
while_statement = "while" expression statements "end".
return_statement = "@" expression.
-assignment = ident "=" expression.
+assign_statement = ident "=" expression.
function_call = ident "[" [ expression_list ] "]".