Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
There are technically no negative numeric literals in ECMAScript. #67
The official ECMAScript grammar parses negative literals as applications of unary minus to a non-negative numeric literal. The ECMAScript grammar (see section 7.8.3 of ECMA-262 5th edition) does not allow a leading + or - sign for a numeric literal.
Currently the spidermonkey asm.js parser accepts "-5" as a numeric literal, as well as "-(5)", but rejects "+5" (and rejects "+(5)" as well).
To be rigorously correct, either you need to introduce a new AsmJSNumericLiteral production which allows the leading -, or add a note to section 4 indicating that all uses of NumericLiteral are intended to also match a leading minus, followed by an optionally-parenthesized NumericLiteral.
referenced this issue
Jun 12, 2013
https://bugzilla.mozilla.org/show_bug.cgi?id=886285 is related.