正则语言和正则语法之间的区别
我的书对常规语法和常规语言给出了类似但略有不同的解释。 我怀疑这是错误的,正则语言和正则语法是一样的吗? 我的书的定义是: 如果所有产生式都是 V-> ,则语法是正则的。 aW或V→Wa,其中V、W非终结符或终结符,“a”终结符。W也可以为空或与V相同。
My book gives similar but slightly different explanations of regular grammar and regular language.
I doubt it's wrong, is a regular language the same thing of a regular grammar?
The definition of my book is:
A grammar is regular if all the productions are V-> aW or V->Wa with V,W non terminal or terminal symbols, "a" terminal symbol.W can also be empty or be the same of V.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正则语法和正则语言是两个不同的术语:
相同的语言可以用不同类别的语法(常规语法、上下文无关语法等)来表示。 如果一种语言可以用规则的语法表示,则该语言被称为规则语言。另一方面,正则语法总是定义正则语言。您发布的是常规语法的定义。
请参阅此维基百科帖子了解更多信息。
Regular grammars and regular languages are two different terms:
The same language could be represented with different class of grammars (regular, context free, etc.). A language is said to be regular if it can be represented with a regular grammar. On the othet hand, a regular grammar always defines a regular language. What you have posted is the definition of the regular grammar.
See this Wikipedia post for further information.
形式语法是一组规则,而形式语言是一组字符串。
正则语法是描述正则语言的形式语法。
根据 维基百科:
在上面,左正则规则是
V->Wa
形式的规则(右正则,V->aW
形式)。A formal grammar is a set of rules, whereas a formal language is a set of strings.
A regular grammar is a formal grammar that describes a regular language.
According to Wikipedia:
In the above, left-regular rules are rules of the form
V->Wa
(right-regular, of the formV->aW
).我认为如果我解释了
语言
和语法
之间的区别,您的疑问将自动得到解决。语言是一组字母表上的一组字符串,满足编码为语法的某些规则,而
语法
用于生成语言。所以基本上语法表示字符串的语法规则,并且可以用语法的起始符号生成的字符串集合称为语法的语言
I think if I explain the difference between a
language
andgrammar
, your queries will automatically get resolved.A
language
is a set of strings over some set of alphabets satisfying certain rules encoded as grammars, whileGrammars
are used to generate languages.So basically
grammars
denote the syntactical rules of a string and the set of strings that can be generated with the start symbol of the grammar is called theLanguage
of thegrammar