[antlr-interest] Anybody tried to parse a Yacc grammar to Ant lr?

Jim O'Connor Jim.O'Connor at microfocus.com
Thu Aug 4 10:19:17 PDT 2005


Hi Barry,
            A converter to transport a yacc grammar to an Antlr grammar
might be helpful.  Some on this list have attempted going from one "style"
or another  to Antlr.  My only experience is with BNF and yacc grammars.  It
is possible to automate some pieces of the conversion with a Yacc=>Antlr
form grammar.  I have not attempted to save time in this fashion. The
recursions and simple repeat items are tricky.  That still doesn't get you
too far down the road to making sure your actions are occurring in the
correct order.
            On another plane, Antlr doesn't think like yacc.  Yacc lexer has
the "longest rule wins" attitude.  Antlr doesn't allow lexical ambiguities.
Yacc parser has a "first rule wins" attitude.  Antlr doesn't allow
reduce/reduce or shift/reduce conflicts.  Yacc passes back a yylval.  Antlr
passes back Tokens - whatever kind you want to make.
 
            Sorry to ramble, but I'll stop here and summarize.  The motion
of Yacc grammar conversion to Antlr grammar is process that may be
automated, but has to be hand checked, IMO.  The mechanisms in your yacc
actions will need rethinking, if only to keep them correct.  On the positive
side,  Antlr is a much more powerful base from which to operate.  
Jim
 
 
 
 
-----Original Message-----
From: Barry McGillin [mailto:barry.mcgillin at oracle.com] 
Sent: Thursday, August 04, 2005 12:20 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Anybody tried to parse a Yacc grammar to Antlr?
 
We want to convert some of our yacc gramamars to Antlr?  Is there such a
thing as a parser for this or is a hand crafted experience? :-)
All tips appreciated!
Barry 
 
 
Click here to report this email as spam.
This message has been scanned for viruses by MailController
<http://www.MailController.altohiway.com/> .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050804/421951ef/attachment-0001.html


More information about the antlr-interest mailing list