diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/mylang.ebnf | 24 | ||||
-rw-r--r-- | doc/praes1/main.tex | 22 |
2 files changed, 23 insertions, 23 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 ] "]". diff --git a/doc/praes1/main.tex b/doc/praes1/main.tex index e924838..2f85422 100644 --- a/doc/praes1/main.tex +++ b/doc/praes1/main.tex @@ -107,17 +107,17 @@ end \pause\item Top-Down-Parsing \pause\item Ableitungsbaum: \begin{itemize} - \pause\item\color{fu-red} Program(Node) - \pause\item\color{fu-red} Function(Node) - \pause\item\color{fu-red} Statement(Node) - \pause\item\color{fu-red} IfStatement(Statement) - \pause\item\color{fu-red} WhileStatement(Statement) - \pause\item\color{fu-red} ReturnStatement(Statement) - \pause\item\color{fu-red} AssignStatement(Statement) - \pause\item\color{fu-red} FunctionCall(Statement) - \pause\item\color{fu-red} Expression(Node) - \pause\item\color{fu-red} UnaryExpression(Expression) - \pause\item\color{fu-red} BinaryExpression(Expression) + \pause\item\color{orange} Program(Node) + \pause\item\color{orange} Function(Node) + \pause\item\color{orange} Statement(Node) + \pause\item\color{orange} IfStatement(Statement) + \pause\item\color{orange} WhileStatement(Statement) + \pause\item\color{orange} ReturnStatement(Statement) + \pause\item\color{orange} AssignStatement(Statement) + \pause\item\color{orange} FunctionCall(Statement) + \pause\item\color{orange} Expression(Node) + \pause\item\color{orange} UnaryExpression(Expression) + \pause\item\color{orange} BinaryExpression(Expression) \end{itemize} \end{itemize} |