自己开发计算器(0)-扩展巴科斯范式(EBNF)

来源:西尖山笔记 责任编辑:栏目编辑 发表时间:2013-07-02 02:53 点击:

基本信息 

扩展巴科斯-瑙尔范式(EBNF)是表达作为描述计算机编程语言和形式语言的正规方式的上下文无关文法的元语法符号表示法。它是基本巴科斯范式(BNF)元语法符号表示法的一种扩展。
它最初由尼古拉斯·沃斯开发,最常用的 EBNF 变体由标准,特别是 ISO-14977 所定义。
 
在这里我们介绍EBNF的一种形式,它由W3C定义。我们可以在XML Path Language (XPath) 2.0 (Second Edition)中找到它的细节,内容如下
 
 A.1.1 Notation
The following definitions will be helpful in defining precisely this exposition.
[Definition: Each rule in the grammar defines one symbol, using the following format:
symbol ::= expression
]
 
[Definition: A terminal is a symbol or string or pattern that can appear in the right-hand side of a rule, but never appears on the left hand side in the main grammar, although it may appear on the left-hand side of a rule in the grammar for terminals.]
 
The following constructs are used to match strings of one or more characters in a terminal:
 
[a-zA-Z]
matches any Char with a value in the range(s) indicated (inclusive).
 
[abc]
matches any Char with a value among the characters enumerated.
 
[^abc]
matches any Char with a value not among the characters given.
 
"string"
matches the sequence of characters that appear inside the double quotes.
 
'string'
matches the sequence of characters that appear inside the single quotes.
[http://www.w3.org/TR/REC-example/#NT-Example]
matches any string matched by the production defined in the external specification as per the provided reference.

Patterns (including the above constructs) can be combined with grammatical operators to form more complex patterns, matching more complex sets of character strings. In the examples that follow, A and B represent (sub-)patterns.
 
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • Android 完全退出程序
  • 原创:Android应用开发-Andorid歌词秀,含源码
  • android 屏幕保护
  • Android手机软件汉化教程---第四课 dex文件汉化
  • 众多Android 开源项目推荐,给力工作给力学习
  • Android Audio代码分析4
  • Android得到已安装的应用程序信息!
  • Android开发者指南(29) —— USB Host and Accessory
  • Android成长的幕后推手:工程师鲁宾
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1