元标识符中的EBNF白间距 [英] EBNF whitespacing in meta identifiers

查看:125
本文介绍了元标识符中的EBNF白间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了EBNF的ISO规范pdf,此处(除了在ISO网站上找不到官方网站(该网站似乎要花钱),我找不到官方网站),而且我不太了解空白.

I looked at the ISO spec pdf for EBNF here (I couldn't find the official one except on the ISO website, where it appears to cost money), and I don't quite understand the whitespace.

有人知道官方标准是否在元标识符中允许使用空格?基于标准文档(第8.1节)中的元标识符,我会说否",但是如果您看一下同一标准文档中的相同示例,则似乎是肯定的.

Does anyone know whether the official standards allow spaces in meta identifiers? Based off the meta identifier in the standards document (section 8.1), I would say no, but if you take a look at that same example in that same standards document, it appears to be saying yes.

在该文档8.1顶部的注释中,似乎是在说它是在使用自身定义EBNF.我对此感到困惑的是这样的行:

In the comment at the top of 8.1 in that document, it appears to be saying that it is defining EBNF using itself. What I'm confused about this is lines such as this:

meta identifier = letter, {letter | decimal digit}
(* A <meta identifier> is the name of a
syntactic element of the language being
defined *);

元标识符本身应该是一个元标识符,但据我所知,它不适合元标识符(然后是任意数量的数字或字母).

meta identifier should be a meta identifier in itself, but as far as I can see, it doesn't fit a meta identifier (letter then any amount of numbers or letters).

有人知道发生了什么事吗?

Does anyone know what's going on?

推荐答案

实际上,正式的ISO EBNF规范(ISO/IEC 14977:1996)可以从ISO网站上免费下载

Actually, the official ISO EBNF spec (ISO/IEC 14977:1996) can be freely downloaded from the ISO website here. That actually defines meta identifier as following:

meta identifier = letter, {meta identifier character};

meta identifier character = letter | decimal digit;

在此定义中引用4.14和4.15.它清楚地表明,元标识符字符仅由字母和十进制数字组成.

It refers to 4.14 and 4.15 in this definition. There it says clearly that a meta identifier character consists only of letters and decimal digits.

奇怪的是,它们用来指定EBNF的EBNF确实在标识符中包含空格.我一直认为EBNF允许在标识符中使用空格.这也是Wikipedia所说的(尽管语法在其他方面还不完整):

It is indeed strange that the EBNF they use to specify EBNF does allow spaces in identifiers. I always believed EBNF allows whitespace in identifiers. This is also what Wikipedia says (although the grammar there is incomplete in other ways):

identifier = letter , { letter | digit | " " } ;

那么也许他们在标准中忽略了这一点?或者我们俩都缺少一些东西.无论如何,我希望您现在已经有了官方标准,就可以弄清楚.

So perhaps they have overlooked this in the standard? Or we are both missing something. Anyway, I hope you can maybe figure it out now that you have the official standard.

这篇关于元标识符中的EBNF白间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆