Negative numbers in the project?

I would like to write some tests which check arithmetic on negative numbers but then I realized that I do not have a Unary Expression class in my AST with a - Operator because the project description does only list those four operators:

’*’ | ’&’ | ’sizeof’ | ’!’

So what about negative numbers?

1 Like

What about 0 - someNumber? That should work if I am not wrong.

Yes, that does work, but I’m still not sure if something like (-1) * 6 should be possible or not.

The parser and the reference support unary negation.
But we do not expect your code to handle the unary minus.

Regarding negative numbers:
The result of (0-1)*6 should be -6.