[antlr-interest] Yacc to antlr guide?
Christopher Nebel
c.nebel at apple.com
Fri Nov 14 00:50:24 PST 2003
Is there documentation somewhere on how to translate yacc grammars into
antlr? I've got a non-trivial yacc-based grammar I'd like to port.
Most of the basic grammar parts are straightforward, if tedious, but
I'm having two specific problems:
1. How do I deal with operator precedence? The yacc grammar uses
precedence declarations, and I don't see any equivalent. Obviously, I
could break the big rules apart into smaller ones that reflect the
precedence, but I'm hoping for something more direct.
2. The actions in the original make heavy use of $[$12...], and it's
not clear to me how to deal with that. Well, it kind of is. I can see
the "rule returns [T v]" bit, but I'm not looking forward to adding
that to every single rule -- is there some way to say that all rules
return a T without decorating each of them individually? The custom
AST stuff is also sort of applicable, but I've got a bunch of weird
constraints (notably the fact that the type is *not* a C++ object) that
make using it somewhat impractical.
Thanks,
--Chris Nebel
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list