[antlr-interest] More hoisting pain
Sam Barnett-Cormack
s.barnett-cormack at lancaster.ac.uk
Mon Jun 1 06:43:18 PDT 2009
Hi all,
Resolved with scoping, but I'm sure this problem is occuring more than
one might hope. Is this something the devs are considering and/or
working on?
Sam
Sam Barnett-Cormack wrote:
> Hi all,
>
> Been away from work ill for a while, and now returning to my ASN.1 project.
>
> I'm having another hoisting issue. I have the following rule:
>
> fixedTypeValueFieldSpec
> : IOLCID t=typeOrClass
> ({!($t.obj)}? UNIQUE
> |)
> ( {!($t.obj)}? valueOptionalSpec
> | {$t.obj}? objectOptionalSpec
> ) ;
>
> The obj element of the typeOrClass return is just a boolean. The problem
> is that the decision is being hoisted to a DFA class, which can't see t.
> I have really no idea how to approach this. If it worked, it would be a
> relatively clean, not too inefficient (I think) way to handle the
> problem of two *very* similar grammar specifications that cause a lot of
> ambiguity otherwise. However, although t has already been set when the
> DFA is called, it obviously can't see it.
>
> For background, this was originally two rules (well, three, one main one
> that called two others), but problems with lookahead due to recursion
> meant that it was ambiguous. On the face of it, this should be a
> comfortable partial merging (relying on three other rules, of course).
>
> Can anyone suggest a resolution? I'm running 3.1.3 inside Eclipse using
> ANTLR-IDE.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list