exp
|
::=
|
num  | 
exp op exp  | 
( exp )
|
op
|
::=
|
+  | 
-  | 
*  | 
/
|
num
|
::=
|
0  | 
1  | 
2  | 
3  | 
4  | 
5  | 
6  | 
7  | 
8  | 
9
|
where {exp,op,num} is the set of non-terminal symbols,
exp is the start symbol,
and { 0,1,2,3,4,5,6,7,8,9,+,-.*,/,(,) }
is the set of terminal symbols.
The grammar generates a subset of the Java expressions of type int.
The various integer operators have precedences as in Java
(see the Java specification).