[antlr-interest] Proglem about the root of ASTree
sishen
sishen_freecity at 126.com
Thu Sep 21 06:42:50 PDT 2006
Thanks.
In my opinion, This restriction is too strict. :(
it's can't be reuseable.
And i should use multiple label to mark the token..... like op1:">"^ |
op2:"<"^ | op3:"=".....
Bryan Ewbank wrote:
> Yes, this is a restriction - the '^' has to be at a token, because
> that way it's guaranteed to be a single tree node. Rewrite it this
> way:
>
> test : ID ( ">"^ | "<"^ ) expr ;
>
> Hope this helps,
> - Bryan Ewbank
>
> On 9/21/06, sishen <sishen_freecity at 126.com> wrote:
>> I set buildAST = true;
>>
>> I found something doesn't work when i defined a root.
>>
>>
>> for example:
>>
>> test : ID op expr
>>
>> op:
>> ">"
>> | "<"
>> ;
>>
>>
>> i want "op" to be the root of expression.
>> but i can't just write "op^". it's a fault.
>>
>> However, when i write op suffix the operator ">"/"<". it's also
>> unuseful.
>>
>> What should i do? thx all~
>>
>>
>
>
More information about the antlr-interest
mailing list