[antlr-interest] ANTLRWorks destroys its AST
Stephan Opfer
stephan.opfer at gmx.net
Sat May 12 02:48:27 PDT 2012
Hi,
your advice worked like a charm. Thank you!
Does anybody know how I can replace the grammar I uploaded with the new
one? I am talking about the grammar repository on antlr.org
Best Regards,
Stephan
On 05/12/2012 05:15 AM, John B. Brodie wrote:
> Greetings!
>
> Summary: your abbreviation rule has 3 paths for recognition.
> You have supplied '->' rules for only 2 of the paths.
>
> On 05/11/2012 04:20 AM, Stephan Opfer wrote:
>> Dear ANTLR-Interest Group,
>>
>> I have two grammars, which are almost the same and an example input: A &
>> B | C & !A | (D | E) & F
>>
>> The first grammar works quite nice, the other grammar generates NIL as
>> AST. However, next to the last step in debugging both grammars produced
>> exactly the same ParseTree and exactly the same AST.
>>
>> Just after the consumption of <EOF> the other grammar throws the
>> computed AST away.
>
> because you have not told ANTLR what to do with that tree.
>
>>
>> Is it just a ANTLRWorks problem or does anybody know, what I am doing
>> wrong. The only difference between the two grammars is the additional
>> abbreviation rule.
>>
>
> abbreviation :
> f1=formula
> ( ( /* EMPTY */ -> $f1 )
> | ( IMPLY f2=formula -> ^(OR ^(NOT $f1) $f2) )
> | ( BIIMPLY f2=formula ->
> ^(AND ^(OR ^(NOT $f1) $f2) ^(OR ^(NOT $f2) $f1)) )
> );
>
>
> 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