BSON | terminal and non-terminal

流过昼夜 提交于 2019-12-23 07:24:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!