12

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?

Shamaoke
  • 6,222
  • 8
  • 34
  • 40

1 Answers1

21

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

iabdalkader
  • 17,009
  • 4
  • 47
  • 74