Reputation: 107
I read somewhere [x],y
in this notation, x
is optional, but I could not understand what is meant by optional. Does it means, there can be y
or x,y
or something else? Can anyone give some example about this?
Upvotes: 3
Views: 3866
Reputation: 24148
Yes.
Documentation about []
:
Optional: The items between
[
and]
are optional. All or none of the items in the brackets are included.
In EBNF []
stands for optional parameters that can be ommitted, so [x],y
defines the possibilities y
and xy
.
Example:
Bicycle_Accessories = saddle [bell | horn] {water_bottle_holders}
defines next possibilities:
saddle
saddle bell
saddle horn
saddle water_bottle_holder
saddle bell water_bottle_holder
saddle bell water_bottle_holder water_bottle_holder
Upvotes: 4