KhronosGroup / NNEF-Docs

NNEF public repository
Apache License 2.0
14 stars 3 forks source link

specification of negative numeric literal values #4

Closed jnorwood closed 6 years ago

jnorwood commented 6 years ago

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.

gyenesvi commented 6 years ago

This is currently treated differently by the flat/compositional parsers, and needs to be clarified in the spec/grammar.

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.

jnorwood commented 6 years ago

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?

gyenesvi commented 6 years ago

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.

gyenesvi commented 6 years ago

This has been fixed in the final version of the spec.

jnorwood commented 6 years ago

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.

gyenesvi commented 6 years ago

We could rephrase it as "not allowed as part of the numeric literal". Does that explain it better?

jnorwood commented 6 years ago

yes, that's fine. I'm closing this.