简体   繁体   English

有限和无限语言的混淆

[英]Finite and Infinite languages confusion

I have recently started studying Formal Language Theory and having some problems with finite and infinite languages. 我最近开始学习形式语言理论,并且对有限和无限语言有一些疑问。

I have been told that all finite languages are regular. 有人告诉我所有有限的语言都是正规的。

However, reading through the notes given to me, a grammar with productions: 但是,请仔细阅读给我的注释,其中是带有结果的语法:

S --> ab

S --> aabb

S --> aaabbb

Is not a regular language although the productions generate a finite number of strings. 尽管产生的字符串数量有限,但它不是常规语言。

However, a grammar with the productions: 但是,产生式的语法:

S --> Sb

S --> Tb

T --> Ta

T --> a

Which generate strings of the form a^mb^n, which is an infinite list of strings yet this language is defined as regular? 哪个生成形式为a ^ mb ^ n的字符串,a ^ mb ^ n是无限的字符串列表,但该语言被定义为常规语言?

Could anyone help me to understand in simple terms? 有人可以帮助我简单地理解吗? Would be really appreciated as I am struggling. 在我努力的过程中,我们将不胜感激。

Questions on theory might get quicker answers in https://cs.stackexchange.com/ , however there are still people who can answer here. 关于理论的问题可能会在https://cs.stackexchange.com/中获得更快的答案,但是仍然有人可以在这里回答。

You are forgetting that the relationship is not symmetric. 您忘记了这种关系不是对称的。 All finite languages are regular, but not all regular languages are finite. 所有有限语言都是常规语言,但并非所有常规语言都是有限语言。 In the same way all regular languages are context free but not all context free languages are regular. 同样,所有常规语言都是上下文无关的,但并非所有上下文无关语言都是常规的。 The relationship is nicely illustrated in Cleaveland, JC & Uzgalis, RC (1977) Grammars For Programming Languages , Elsevier North Holland, pp.20: 这种关系在Cleaveland,JC和Uzgalis,RC(1977) 语法的编程语言 ,北荷兰Elsevier,第20页中得到了很好的说明:

语言分类

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

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