Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any bison yacc to ANTLR converter available

Tags:

antlr

I have a yacc grammar that I want to convert to ANTLR. Is there any Bison to
ANTLR converter available? Can someone help?

Thanks, Prasanth

like image 344
Prasanth Avatar asked Aug 07 '14 09:08

Prasanth


People also ask

Do people still use YACC?

Yes, this stuff is still used.

What is yacc bison?

Bison originated as a workalike of a program called Yacc — Yet Another Compiler Compiler. 9. Yacc was written at Bell Labs as part of the very early development of Unix; one of its first uses was to develop the original Portable C Compiler, pcc. The same person, Steven C. Johnson, wrote Yacc and the original pcc.

What does Antlr generate?

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

What is Antlr used for?

ANTLR (ANother Tool for Language Recognition) is a tool for processing structured text. It does this by giving us access to language processing primitives like lexers, grammars, and parsers as well as the runtime to process text against them. It's often used to build tools and frameworks.


1 Answers

Let's compare these parser generators:

  • ANTLR v4 is an ALL(*) parser generator, a variant of LL(*)
  • Yacc is a LALR parser generator.
  • Bison is a LALR/GLR parser generator.

LL and LALR are incompatible:

The LALR(k) parsers are incomparable with LL(k) parsers: for any j and k both greater than 0, there are LALR(j) grammars that are not LL(k) grammars and conversely. In fact, it is undecidable whether a given LL(1) grammar is LALR(k) for any k > 0.

GLR is a variant of LR. An LR parser is a bottop-up parser, while an LL parser is a top-down parser. Those are fundamentally different parsing strategies.

Conclusion: you won't find any reliable automatic converter any time soon.

like image 61
Lucas Trzesniewski Avatar answered Nov 15 '22 08:11

Lucas Trzesniewski