[antlr-interest] Handling negative numbers
gt54-antlr at cyconix.com
Thu Aug 17 07:11:57 PDT 2006
Sathish K wrote:
> Could anyone please guide me as to how to handle negative numbers while parsing?
> I am currently unable to handle the number and the sign as a whole.
Are you sure you want to handle them together? Would it better to parse
all numbers as positive numbers, and sort out the '-' in semantic analysis?
How do you analyse:
A = B - C # subtraction
A = B -C # no operator?
A = -C # unary minus
A = - C # unary minus?
More information about the antlr-interest