(x+2)*y expression | | term / | \ term * factor | | factor identifier / | \ | (expression) y / | \ expression + term | | term factor | | factor literal | | identifier 2 | x
2*x+3/y-4 expression / | \ expression - term / | \ | expression + term factor / / | \ | term term / factor identifier / | \ | | | term * factor factor identifier 4 | | | | factor identifier literal y | | | literal x 3 | 2
1 expression | term | factor | literal | 1
S::=S1S2 S1::=lambda|aS1b S2::=lambda|bS2a
S::=S1S1S1S1S1S2 S1::=a|b S2::=lambda|aS2|bS2
expression / | \ exp and exp / | \ | exp and exp false | | false true expression / | \ exp and exp | / | \ false exp and exp | | true false
A::=B imp A| B B::=B and C| C C::=not C| D D::=true|false
Declaration / \ Type Declarator | / / | \ int Declarator [ Number] / \ * Declarator | name Declaration / / \ Type * Declarator | / / | \ int Declarator [ Number] | name
Declaration::= Type Declarator Type ::= int|char Declarator ::= * Declarator|Dec Dec ::= Dec '['number']'| Dec '('Type')' | '('Declarator')' | name
For instance:
int name *'['number']' '('int')' * '('char')' Declaration / \ Type Declarator | / / |\ int Declarator (Type) / \ Declarator * / / | \ Declarator ( Type ) / / | \ | Declarator [ number] int / \ Declarator * | nameAll declarators are to the left of the tree except the first one. This is the only derivation tree of the expression.