[antlr-interest] Problems with Antlr3 rewrite rules

shmuel siegel antlr at shmuelhome.mine.nu
Wed Jun 6 04:44:39 PDT 2007


We've been told that this mail list is the triage for bug reports. This 
patient has been languishing in triage for three days. There hasn't even 
been any placebos offered. Has there been a specification change? Is 
there one or more bugs here? As I stated, I have a workaround for the 
first issue but none for the second issue.

I would really like to move up to the release version but these two 
issues are standing in my way. Can I get some help.

shmuel siegel wrote:
> It seems that the problems were introduced with the move to 
> RewriteRuleSubtreeStream. I don't see any other substantive changes in 
> the generated parser code.
>
> Shmuel Siegel wrote:
>>
>> I have upgraded my production grammar from 3.0b6 to the release 
>> version. I am having two problems with the rewrite rules. Hopefully I 
>> just missed a specification change.
>>
>>  
>>
>>     * Problem 1: When I have subclauses that do rewrites, the final
>>       rewrite gets a null pointer exception. The following rule used
>>       to work but now throws an exception. I avoid the exception if I
>>       extract the parenthesized sub-rule and make it a named rule.
>>
>> assignEntityAttr:
>>
>>             (
>>
>>                         thisNode->thisNode
>>
>>                   |     symbolTableElement->symbolTableElement
>>
>>                   |     positionalElement->positionalElement
>>
>>             )
>>
>>             '.' a='attr' op='=' attr=attrValue    
>>             -> ^(ASSIGN[$op] ^($assignEntityAttr PROPERTY[$a]) $attr)
>>
>>             ;
>>
>>  
>>
>>     * Problem 2: Tree construction seems to have changed. I used to be
>>       able to write
>>           o ^($ent PROPERTY[$a]) where $ent was itself a tree. When I
>>             do it now, I keep the head of the $ent tree but its
>>             children are replaced by the PROPERTY token.
>>
>>  
>>
>>  
>>
>> What has changed since b6?
>>
>>  
>>
>> Shmuel
>>
>
>




More information about the antlr-interest mailing list