I mean, suppose I have this expression:
2 + 2
I want to get something like this:
as an output. I've tried FullForm, but this just evaluates 2+2 and returns 4. Is this even possible?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community
tree = Function[x, Defer @ FullForm @ x, HoldAll];
2 + 2 // tree
For some explanation of the mechanics of this code see: Why doesn't "Defer" work with "TableForm"?
See also my standard methods for analyzing parsing.