[antlr-interest] Re: ANTLR 3.0 question about common actions
Monty Zukowski
monty at codetransform.com
Thu Jul 29 10:12:25 PDT 2004
On Jul 28, 2004, at 6:22 PM, thrutchy wrote:
> Anyways, you might think about setting things up such that a
> syntax/rule/sub-rule is an object that is used to read/write/lookahead
> streams/trees. If nothing else, it would make the generated code even
> more understandable. But, I think it will open up other doors not
> thought of - like defining a rule that has a rule as an argument
> (because a rule is now an object that can be passed around). i.e.
>
> list[Syntax item, sep] ::= item ( sep item )*
>
Although ANTLR generates methods for each rule, those methods are
highly interdependent because of lookahead. That's why adding an
alternative to one rule can lead to dozens of ambiguities in other
rules that directly or indirectly call that rule.
From what I gather, you are talking about having an interpreted parser
built by building objects and connecting them. To do that you will
need to come up with a scheme so all the rules can be analyzed and have
lookahead conditions stored in them. Parser rules are not modular the
way that object methods are.
Monty
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list