This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
when parsing the right-hand-side of the equals sign, you parse the tokens in order. first, you parse the 'x' token. it is 4. you remember that.
then you parse the '+' token, which is saved for the moment.
then you parse the ++x token. this says "increment x, then get that value". so x is 4, you increment it to 5, and return the 5. you now us the remembered value of 4, the +, and the value of 5 in your addition.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors