[antlr-interest] antlr gramma versus yacc grammar

Kevin J. Cummings cummings at kjchome.homeip.net
Tue Nov 20 14:42:21 PST 2007


Mathew Yeates wrote:
> I haven't found mention of yacc yet in the book. How do yacc and antlr
> differ?

YACC is LALR(1) (or almost LALR(1)), while ANTLR is LL(k).

If you understand the differences in the parsing techniques, then the
translation becomes easy.  If you don't, then you need to understand
that most LALR(1) grammars factor in the opposite direction from LL(k)
grammars.  So you will need to invert the direction of the recursion.

> I have found a fortran 77 yacc/lex grammar as part of the f2c package at
> netlib. How difficult is it to turn this into a antlr grammar? I know
> ... Someone write a translator!!

Shouldn't be too difficult, and it should be a straight-forward problem
to solve.  Let us know where you get stuck, and we can help.

> Mathew

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the antlr-interest mailing list