Flex / Lex和Yacc / Bison有什么区别?

时间:2022-04-30 09:43:00

What is the difference between Flex & Lex and Yacc & Bison. I searched the Internet wildly and I didn't find any solid answer.

Flex&Lex和Yacc&Bison有什么区别。我疯狂地搜索了互联网,但没有找到任何可靠的答案。

Can I install pure Lex and Yacc on Ubuntu, or I can install only flex and bison. I am confused.

我可以在Ubuntu上安装纯Lex和Yacc,或者我只能安装flex和bison。我很迷惑。

  • Is Lex or Yacc still being maintained by someone?
  • Lex或Yacc仍在被某人维护吗?

  • Are all of them free?
  • 他们都是免费的吗?

  • If Lex is not free why do I have it installed on my Ubuntu distribution?

    如果Lex没有免费,我为什么要在我的Ubuntu发行版上安装它?

    lex --version
    lex 2.5.35
    

5 个解决方案

#1


There are some differences between Lex and Flex, but you have to be abusing Lex to run into the problems with Flex. (I have a program which abuses Lex and doesn't work under Flex, therefore.) This is primarily in the area of input lookahead; in Lex, you can provide your own input code and modify the character stream; Flex won't let you do that.

Lex和Flex之间存在一些差异,但你必须滥用Lex来解决Flex的问题。 (因此,我有一个滥用Lex并且不能在Flex下工作的程序。)这主要是在输入前瞻方​​面;在Lex中,您可以提供自己的输入代码并修改字符流; Flex不会让你这样做。

Yacc and Bison are pretty closely compatible, though Bison has some extra tricks it can do.

Yacc和Bison非常紧密兼容,尽管Bison有一些额外的技巧。

You probably can't find legitimate copies of (the original, AT&T versions of) Lex and Yacc to install on Ubuntu. I wouldn't necessarily say it is impossible, but I'm not aware of such. Flex and Bison are readily available and are equivalent for most purposes. You may also find various alternative and approximately equivalent programs from the BSD world.

您可能找不到要在Ubuntu上安装的Lex和Yacc的原始(AT&T版本)的合法副本。我不一定说这是不可能的,但我不知道这样的。 Flex和Bison随时可用,并且在大多数情况下都是等效的。您还可以从BSD世界中找到各种替代和近似等效的程序。

Lex and Yacc are maintained by the Unix SVRx licencees - companies such as IBM (AIX), HP (HP-UX) and Sun (Solaris) have modified versions of Lex and Yacc at their command. MKS also provides MKS Lex and MKS Yacc; however, the Yacc at least has some non-standard extensions.

Lex和Yacc由Unix SVRx许可证维护 - 例如IBM(AIX),HP(HP-UX)和Sun(Solaris)等公司已根据其命令修改了Lex和Yacc的版本。 MKS还提供MKS Lex和MKS Yacc;但是,Yacc至少有一些非标准扩展。

Flex and Bison are free. (AT&T) Lex and Yacc are not.

Flex和Bison是免费的。 (AT&T)Lex和Yacc不是。

#2


Bison is the GNU implementation/extension of Yacc, Flex is the successor of Lex. In either case, it's fine (and recommended) to use bison / flex.

Bison是Yacc的GNU实现/扩展,Flex是Lex的继承者。在任何一种情况下,使用bison / flex都很好(并且推荐)。

#3


On most (all?) Linux systems, "Lex" is actually a symbolic link to flex. Basically, it's only a different name to the free version.

在大多数(所有?)Linux系统中,“Lex”实际上是flex的符号链接。基本上,它只是一个与免费版本不同的名称。

#4


YACC is available under open source licenses from both Plan 9 and Open Solaris. Also, there is also Berkeley YACC, which is compatible with the original YACC, but does not share source code. Berkeley YACC can be found on any of the open source BSD operating systems.

YACC可在Plan 9和Open Solaris的开源许可下使用。此外,还有Berkeley YACC,它与原始YACC兼容,但不共享源代码。 Berkeley YACC可以在任何开源BSD操作系统上找到。

#5


Bison in a part of the GNU project. And yacc is used as a utility on Berkeley Software Distribution (BSD).Though its compatible with yacc, but Lex and Yacc are a thing of the past. Flex and bison are widely used today.

Bison是GNU项目的一部分。 yacc在Berkeley Software Distribution(BSD)上用作实用程序。虽然它与yacc兼容,但Lex和Yacc已经成为过去。 Flex和Bison今天被广泛使用。

#1


There are some differences between Lex and Flex, but you have to be abusing Lex to run into the problems with Flex. (I have a program which abuses Lex and doesn't work under Flex, therefore.) This is primarily in the area of input lookahead; in Lex, you can provide your own input code and modify the character stream; Flex won't let you do that.

Lex和Flex之间存在一些差异,但你必须滥用Lex来解决Flex的问题。 (因此,我有一个滥用Lex并且不能在Flex下工作的程序。)这主要是在输入前瞻方​​面;在Lex中,您可以提供自己的输入代码并修改字符流; Flex不会让你这样做。

Yacc and Bison are pretty closely compatible, though Bison has some extra tricks it can do.

Yacc和Bison非常紧密兼容,尽管Bison有一些额外的技巧。

You probably can't find legitimate copies of (the original, AT&T versions of) Lex and Yacc to install on Ubuntu. I wouldn't necessarily say it is impossible, but I'm not aware of such. Flex and Bison are readily available and are equivalent for most purposes. You may also find various alternative and approximately equivalent programs from the BSD world.

您可能找不到要在Ubuntu上安装的Lex和Yacc的原始(AT&T版本)的合法副本。我不一定说这是不可能的,但我不知道这样的。 Flex和Bison随时可用,并且在大多数情况下都是等效的。您还可以从BSD世界中找到各种替代和近似等效的程序。

Lex and Yacc are maintained by the Unix SVRx licencees - companies such as IBM (AIX), HP (HP-UX) and Sun (Solaris) have modified versions of Lex and Yacc at their command. MKS also provides MKS Lex and MKS Yacc; however, the Yacc at least has some non-standard extensions.

Lex和Yacc由Unix SVRx许可证维护 - 例如IBM(AIX),HP(HP-UX)和Sun(Solaris)等公司已根据其命令修改了Lex和Yacc的版本。 MKS还提供MKS Lex和MKS Yacc;但是,Yacc至少有一些非标准扩展。

Flex and Bison are free. (AT&T) Lex and Yacc are not.

Flex和Bison是免费的。 (AT&T)Lex和Yacc不是。

#2


Bison is the GNU implementation/extension of Yacc, Flex is the successor of Lex. In either case, it's fine (and recommended) to use bison / flex.

Bison是Yacc的GNU实现/扩展,Flex是Lex的继承者。在任何一种情况下,使用bison / flex都很好(并且推荐)。

#3


On most (all?) Linux systems, "Lex" is actually a symbolic link to flex. Basically, it's only a different name to the free version.

在大多数(所有?)Linux系统中,“Lex”实际上是flex的符号链接。基本上,它只是一个与免费版本不同的名称。

#4


YACC is available under open source licenses from both Plan 9 and Open Solaris. Also, there is also Berkeley YACC, which is compatible with the original YACC, but does not share source code. Berkeley YACC can be found on any of the open source BSD operating systems.

YACC可在Plan 9和Open Solaris的开源许可下使用。此外,还有Berkeley YACC,它与原始YACC兼容,但不共享源代码。 Berkeley YACC可以在任何开源BSD操作系统上找到。

#5


Bison in a part of the GNU project. And yacc is used as a utility on Berkeley Software Distribution (BSD).Though its compatible with yacc, but Lex and Yacc are a thing of the past. Flex and bison are widely used today.

Bison是GNU项目的一部分。 yacc在Berkeley Software Distribution(BSD)上用作实用程序。虽然它与yacc兼容,但Lex和Yacc已经成为过去。 Flex和Bison今天被广泛使用。