From 91ae46d9f2087272d4bd27a2b12f52fd1d782caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Tue, 9 Jun 2009 08:44:03 +0200 Subject: strictly seperate boolean and numeric expressions --- doc/mylang.ebnf | 24 ++++++++++++------------ 1 file 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 ] "]". -- cgit v1.2.3