I'm learning BNF, and the text I'm using gives a simple grammar for integer expressions like this:
<expression> ::= <number> | <expression> <operation> <expression>
<operation> ::= + | - | x
<number> ::= <digit> | <digit> <number>
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
This makes sense to me, but then it goes on to show that you can have two non-terminal symbols on the left hand side of expression like this:
e,f ::= n | (e o f)
o ::= + | - | x
n ::= d | d n
d ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
I don't understand what it means to have both e
and f
on the left hand side: what does it mean and what is the point of it?