[antlr-interest] Grammar non-determinism problem
antlr4 at mordent.com
Thu Jun 10 07:52:32 PDT 2004
I've written way too many parsers and am soooo tired of the tedious
task of fixing grammar conflicts (especially in LL(k) parser
tools! :D ). In any case, I'm hoping someone can help me with this
one (just to let you know, this isn't a homework problem, I'm working
on a compiler for myself to learn more backend stuff since I've been
doing mostly front end stuff for too long).
Here's a snippet of a grammar that's giving me non-determinism errors
between end of blocks:
: ( decl )*
: TYPE ID ... // don't worry about this ...
// it has nothing to do with the problem
: VAR ID TYPEID
: FUNC ID ...
The non-determinism happens between decl's (typedecl)+ and decls'
(decl)*. I can't think of any other way to rewrite this to do what I
need to do. The problem is that I need to group typedecls together
because some of them can be mutually recursive structure types (but
only those in the same group can be, otherwise I wouldn't group them
at all because without the + this grammar works!). I've tried so
many things, hoisting out stuff, hoisting + predicates, other
rewritings that I usually try, but nothing seems to make this
conflict go away.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
More information about the antlr-interest