简体   繁体   English

BNF是否有参数修改?

[英]Are there any modification of BNF with parameters

I mean something like 我的意思是

LISTOF(EL) := "[" EL ("," EL)* "]"
LISTNUM := LISTOF(NUMBER)
LISTID := LISTOF(IDENT)

so, with definitions 因此,带有定义

NUMBER := ('0'-'9')*
IDENT := ('a'-'z'|'A'-'Z')*

we have following 我们有以下

[435,657,44] is example of LISTNUM , [435,657,44]LISTNUM例子,

[dsf,thg,ewre] is example of LISTID . [dsf,thg,ewre]LISTID例子。

Or another example (e means empty string) 或另一个示例(e表示空字符串)

A(0) := e 
A(n) := "a" A(n-1) | e

so, A(5) is set of all strings consist of 'a' with length not more than 5 因此,A(5)由所有长度不超过5的'a'组成的集合

Are there any science works describing something similar to this? 是否有任何科学著作描述了类似的东西? Can we describe our grammars in such way and still be able to parse it in acceptable time? 我们能否以这种方式描述语法,并且仍然能够在可接受的时间内对其进行解析?

The commonly used meta syntaxes such as Bnf, Abnf and Ebnf doesn't have parameterized rules. 常用的元语法(例如Bnf,Abnf和Ebnf)没有参数化规则。 However Iso Ebnf is extensible as per the standard. 但是,根据标准,Iso Ebnf是可扩展的。 If I remember correctly, the standard actually shows an example of introducing parameters. 如果我没记错的话,该标准实际上显示了引入参数的示例。

You can get the standard here for free. 你可以得到标准在这里是免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM