TECHNISCHE UNIVERSITÄT MÜNCHEN
FAKULTÄT FÜR INFORMATIK
Lehrstuhl für Sprachen und Beschreibungsstrukturen WS 11/12
Einführung in die Informatik I 2. Merkblatt
Prof. Dr. Helmut Seidl, M. Schwarz, A. Herz, Dr. M. Petter 27.10.2010
Die Grammatik von MiniJava (aus der Vorlesung):
<program> ::= <decl>* <stmt>*
<decl> ::= <type> <name> (, <name> )* ;
<type> ::= int
<stmt> ::= ;
| { <stmt>* }
| <name> = <expr>;
| <name> = read();
| write(<expr>);
| if (<cond>) <stmt>
| if (<cond>) <stmt> else <stmt>
| while (<cond>) <stmt>
<expr> ::= <number>
| <name>
| (<expr>)
| <unop> <expr>
| <expr> <binop> <expr>
<unop> ::= -
<binop> ::= - | + | * | / | %
<cond> ::= true
| false
| ( <cond> )
| <expr> <comp> <expr>
| <bunop> <cond>
| <cond> <bbinop> <cond>
<comp> ::= == | != | <= | < | >= | >
<bunop> ::= !
<bbinop> ::= && | ||