Closed at15 closed 6 years ago
We need negative number, but if we put the sign into the token INT and DOUBLE, it would create trouble for 1 - 2, it is no longer INT MINUS INT, but INT INT.
INT
DOUBLE
1 - 2
// what we want irk> -1 -1 : float irk > 1 - 2 -1 : float
https://github.com/antlr/grammars-v4/issues/212
http://www.antlr3.org/pipermail/antlr-interest/2006-August/017440.html
Don't bother trying to handle them in the lexer, handle uniary-minus in the parser instead
https://liucs.net/cs664s16/antlr.html
http://teaching.idallen.com/cst8152/97s/unary_minus.html
[x] add unary operations
oops, just tried it again 1 + 2 - 3 is broken .... line 1:3 missing ';' at '-'
1 + 2 - 3
line 1:3 missing ';' at '-'
We need negative number, but if we put the sign into the token
INT
andDOUBLE
, it would create trouble for1 - 2
, it is no longer INT MINUS INT, but INT INT.https://github.com/antlr/grammars-v4/issues/212
http://www.antlr3.org/pipermail/antlr-interest/2006-August/017440.html
https://liucs.net/cs664s16/antlr.html
http://teaching.idallen.com/cst8152/97s/unary_minus.html
[x] add unary operations