问题
Reading through the BSON specification I came across the terminal and non-terminal terms in it. For example:
Valid BSON data is represented by the document non-terminal.
<...>
The following basic types are used as terminals in the rest of the grammar.
What do “terminal” and “non-terminal” mean in the context of the BSON specification?
回答1:
In formal grammar, a terminal symbol is one that cannot be broken down further, e.g. a literal character or digit (but not necessarily as it depends on the grammar), a non-terminal symbol is a symbol that can be reduced further by the production rules (the rules that define the grammar) until it's reduced to a terminal symbol, for example, in the following grammar integer
is a non-terminal symbol, 0-9
are terminal symbols.
<integer> ::= ['-'] <digit> {<digit>}
<digit> ::= '0' | '1' | '2' | > '3' | '4' | '5' | '6' | '7' | '8' | '9'
http://en.wikipedia.org/wiki/Terminal_and_nonterminal_symbols
来源:https://stackoverflow.com/questions/13206423/bson-terminal-and-non-terminal