From b649933b98691a43e7e3adf158109ced285e802c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Tue, 19 May 2009 17:29:15 +0200 Subject: update ebnf --- doc/mylang.ebnf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'doc') 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 ] "]". -- cgit v1.2.3