summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-06-09 08:44:03 +0200
committerBenedikt Böhm <bb@xnull.de>2009-06-09 08:44:03 +0200
commit91ae46d9f2087272d4bd27a2b12f52fd1d782caa (patch)
treee782c9a3c1d7dd55d9ab2b4366bda527b1798f20
parent844580225f0005a71d90fc2c75e8e0c33a4efa2a (diff)
downloadswppy-91ae46d9f2087272d4bd27a2b12f52fd1d782caa.tar.gz
swppy-91ae46d9f2087272d4bd27a2b12f52fd1d782caa.tar.xz
swppy-91ae46d9f2087272d4bd27a2b12f52fd1d782caa.zip
strictly seperate boolean and numeric expressions
-rw-r--r--doc/mylang.ebnf24
1 files changed, 12 insertions, 12 deletions
diff --git a/doc/mylang.ebnf b/doc/mylang.ebnf
index 0ab786d..7c67bbb 100644
--- a/doc/mylang.ebnf
+++ b/doc/mylang.ebnf
@@ -8,25 +8,25 @@ nl = "\n".
ident = letter { letter | digit }.
integer = digit { digit }.
-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 | term "%" unary | unary.
-unary = "!" unary | "-" unary | factor.
-factor = "(" bool ")" | ident | integer | "true" | "false".
+disjunction = conjunction { "||" conjunction }.
+conjunction = boolean { "&&" boolean }.
+boolean = "!" disjunction | comparison | "(" disjunction ")" | "true" | "false".
+comparison = expression ( "==" | "!=" | "<" | "<=" | "=>" | ">" ) expression.
+
+expression = term { ( "+" | "-" ) term }.
+term = unary { ( "*" | "/" | "%" ) unary }.
+unary = ident | integer | "-" unary | "(" expression ")".
ident_list = ident { "," ident }.
expression_list = expression { "," expression }.
-function_list = function { [ nl ] function }.
+function_list = function { nl function }.
statement_list = statement { nl statement }.
-function = "fun" ident "[" [ ident_list ] "]" [ nl ] statement_list [ nl ] "end".
+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".
+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 ] "]".