BNF通常用来定义一些表达式。
• The notation “{}” denotes an optional token within the braces; the braces do not appear in the output token list.
• The notation "( )" groups a sequence of tokens into a single token; the parentheses do not appear in theoutput token list.
• The notation "*" after a token denotes the optional use of multiple instances of that token.
• A character string without any modifying symbols denotes an instance of that character string as a single token.
• The notation "|" denotes a choice of two tokens, and do not appear in the output token list,
• The notation "< >" denotes a production defined elsewhere in the list or a basic type.
• The notation ":=" is a production and the grammar on the left may be replaced with the grammar on the right of this symbol. Production is terminated when no undefined production equations are left unresolved.
现在,几乎每一位新编程语言书籍的作者都使用巴科斯范式来定义编程语言的语法规则。
-----------------------------------------------------------------------------
巴科斯范式的内容
在双引号中的字("word")代表着这些字符本身。而double_quote用来代表双引号。
在双引号外的字(有可能有下划线)代表着语法部分。
尖括号( < > )内包含的为必选项。
方括号( [ ] )内包含的为可选项。
大括号( { } )内包含的为可重复0至无数次的项。
竖线( | )表示在其左右两边任选一项,相当于"OR"的意思。
::= 是“被定义为”的意思