Closed jnorwood closed 6 years ago
This is currently treated differently by the flat/compositional parsers, and needs to be clarified in the spec/grammar.
-x
) and therefore the minus sign before a number will also be interpreted as a unary minus operator, hence negative numbers are not needed.I could not find a unified solution that works for both. Alternatively, we can just enable negative numbers in the compositional case too, although they will never be interpreted as such by the parser.
Ok, so you are saying it will be necessary to specify negative literal values in the flat case, since there are no expression operations for the flat parsing (specifically no unary minus).
For the compositional case:
Is there a use case that requires a unary + arithmetic operator?
Yes, the flat case needs the negative literals, and it could be disabled in the compositional case.
I don't know of any use cases that explicitly require the unary + operator.
This has been fixed in the final version of the spec.
Ok, thanks. The spec expanation that minus is not allowed is a little confusing. The unary minus is still allowed, but is handled by the expression evaluator instead of as a negative literal value.
We could rephrase it as "not allowed as part of the numeric literal". Does that explain it better?
yes, that's fine. I'm closing this.
The specification of numeric literal values in the grammar does not explicitly state that an optional minus sign can appear before the integer part. Although this can be implemented later as a unary minus expression, it seems more appropriate to support a signed numeric data type.