bnf |
您所在的位置:网站首页 › dab文件怎么转换为bnf › bnf |
如何将此 BNF 转换为 EBNF? ::= var ; ::= {;} ::= {,} : ::= {} ::= | | _最佳答案 EBNF 或 Extended Backus-Naur Form是 ISO 14977:1996 ,并且可以从 ISO 免费获得 PDF 格式*。它没有被计算机语言标准广泛使用。还有一个paper描述它,并且那篇论文包含这个总结EBNF符号的表格。 Table 1: Extended BNF Extended BNF Operator Meaning ------------------------------------------------------------- unquoted words Non-terminal symbol " ... " Terminal symbol ' ... ' Terminal symbol ( ... ) Brackets [ ... ] Optional symbols { ... } Symbols repeated zero or more times { ... }- Symbols repeated one or more times† = in Defining symbol ; post Rule terminator | in Alternative , in Concatenation - in Except * in Occurrences of (* ... *) Comment ? ... ? Special sequence *运算符与前面的(无符号)整数一起使用;它似乎不允许可变数量的重复——例如在初始字符后 1-15 个字符使标识符长达 16 个字符。这个列表在标准中,左括号 (称为起始组符号和右括号 )称为端基符号;开方括号[是开始选项符号,右方括号是结束选项符号;开撑{是开始重复符号和右大括号 }是结束重复符号。单引号 '被称为首引号和双引号 "是第二个引号。 * 是的,免费 - 即使您愿意,也可以支付 74 瑞士法郎。查看包含收费项目的框下方的注释。 该问题旨在将此“BNF”转换为 EBNF: ::= var ; ::= {;} ::= {,} : ::= {} ::= | | _ BNF 没有正式定义,因此我们必须对其含义进行一些(简单的)猜测。翻译是常规的(如果 BNF 被正式定义,它可能是机械的):vardec = 'var', vardeclist, ';'; vardeclist = varandtype, { ';', varandtype }; varandtype = ident, { ',', ident }, ':', typespec; ident = letter, { idchar }; idchar = letter | digit | '_'; 必须移除非终端周围的尖括号;定义符号::=被 = 取代;终端如 ;和 _用引号括起来;连接被明确标记为 , ;每个规则都以 ; 结束.原文中的分组和替代操作恰好与标准符号一致。请注意,用逗号显式连接意味着多词非终结符是明确的。† 对标准本身的随意研究表明 {...}-符号不是标准的一部分,只是论文的一部分。但是,如 jmmut注释在 comment ,标准确实定义了 {…}- 的含义:
§5.8 Syntactic term … When a syntactic-term is a syntactic-factor followed by an except-symbol followed by a syntactic-exception it represents any sequence of symbols that satisfies both of the conditions: a) it is a sequence of symbols represented by the syntactic-factor, b) it is not a sequence of symbols represented by the syntactic-exception. … NOTE - { "A" } - represents a sequence of one or more A's because it is a syntactic-term with an empty syntactic-exception. 关于bnf - 如何将 BNF 转换为 EBNF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14922242/ |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |