Hi,

I struggling with the error "Mismatched tree node" at my C grammar.
The error disappears if i remove the '+' at the imaginary node
creation for  TOK_ARRAY_INDEX to  -> ^(TOK_ARRAY_INDEX expression)
The examples in Terence book shows exactly this to collect input
elements.
The rule 'arrayDef' doesn't generate the error but i got only 1 node,
even for multidimensional array definition like 'a[1][2][3];'

// 1. problem

arrayIdent
        : IDENT^ arrayDef
        ;
arrayDef        // like a[1][2][3]...
  : arrayDefTmp (arrayDefTmp)*  -> ^(TOK_ARRAY_DEF arrayDefTmp+)
  ;
arrayDefTmp
  : '['! intConst ']'!
  ;

.....

// 2. problem

postfixExpression
  : methodCall
  | encapsulatedExpression
  | IDENT {
    ( '++' -> ^(TOK_POSTINC primaryExpression)
    | '--' -> ^(TOK_POSTDEC primaryExpression)
    | arrayIndex*   //-> ^(primaryExpression arrayIndex)
    )
  ;

arrayIndex
  : ('[' expression ']') -> ^(TOK_ARRAY_INDEX expression+)
  ;


Can anyone give me a hint?
Thx


-- 
Christian Hoffmann
Ützenkamp 4
38118 Braunschweig
Tel: 0171/7300609
Web: www.c-hoffmann.de
     www.logical-arts.de


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to