I'm currently writing a compiler for the C-language, and stumbled upon something rather peculiar. I know that the increment operator ++ can be prefix or postfix, I know that it can be used in expressions.
- So the line:
a++, whereais an integer variable, should be legal. - The line:
(a++)-(++b)should also be legal. - The line:
a++-++bis also legal. - The line:
a++/++bis also legal.
This leads me to conclude that:
<variable><++><operator><++><variable>, where operator is any binary operator should be legal.
What confuses me, is that the line a+++++b is not legal. Why is this not legal? Is it something to do with how GCC lexes the expression a+++++b?
I'm running GCC 7.2.0.