[antlr-interest] Formula Parser once again

Stritzel.Nils at infineon.com Stritzel.Nils at infineon.com
Wed Apr 19 18:35:27 PDT 2006


 
Thanks this helped:
functionCall : CABS^ LPAREN! batchExpr RPAREN!

Actually there was another error, a spelling mistake (had LPARENT
instead of LPAREN)

Thanks,

Nils   

-----Original Message-----
From: John B. Brodie [mailto:jbb at acm.org] 
Sent: Wednesday, April 19, 2006 8:56 PM
To: Nils Stritzel (IFIS DC)
Subject: Re: [antlr-interest] Formula Parser once again

You asked about parsing a function call.

You have:

functionCall : CSIGN^ LPARENT^ batchExpr RPARENT!      
  	     ;

in your parser, but CSIGN isn't defined anywhere. Your lexer produces a
CABS token and your treewalker is expecting a CABS batchExpr node. Maybe
CSIGN should be CABS?

Also (but I am not very familiar with trees) you have two consecutive ^
operators in your functionCall rule - doesn't that mean that the root of
the tree will be the *last* ^ seen (e.g. the LPARENT and not the CSIGN,
er CABS)?

So maybe:

functionCall : CABS^ LPARENT! batchExpr RPARENT!      
  	     ;


Hope this helps...
   -jbb


More information about the antlr-interest mailing list