MATH000 MATH000 - 10 months ago 67
C++ Question

Abstract Syntax Tree for this case?

I am trying to create an abstract syntax Tree for the following 2 C/C++/Java code pieces:

1) return j++-200*20-++A*7

2) return j++-200*20-A++*7

Can someone please explain their difference when it comes to their AST?

Answer Source

return j++ - 200*20 - ++A*7 and return j++ - 200*20 - A++*7 will have identical ASTs down to the node involving A. The first will have a pre-increment A node, while the second will have a post-increment A node.