Hello, In my grammar there should be an evaluator for numeric expressions. These numeric expressions should return an integer, or a float, depending on the contents of the expression. For example:
3 + 2.0: should return float 3 + 2: should return integer 2.0 + 3.0: should return float 1 / 3: should return float 4 / 2: should return int In my grammar there is only one rule for a numeric expression. I do not know whether I should duplicate the entire operator precedence rules for the distinction between float and int. The following statements are part of my grammar: expression : list | quotedword | booleanexpression ; booleanexpression : numericexpression (BOOL^ numericexpression)* ; numericexpression : mult ((PLUS^ | MINUS^) mult)* ; mult : atom ((MULTIPLY^ | DIVIDE^) atom)* ; atom : INT | FLOAT | ID | LEFTPAREN expression RIGHTPAREN -> ^(EXPRESSION expression) ; Does anybody have a idea how I should take care of this distinction between float and int? Or is this distinction even necessary? -- Regards, Steven 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.
