traceme true parse(' '[+ [* when this tree is evaluatedthe apply method recursively evaluates subtrees and applies root operators to their results hereis evaluated before +since it' lower in the tree the factor method consumes the substring before returning right subtree to expr the next tree takes different shapep parse(' '[-[* in this exampleis evaluated before the factor method loops through substring of and expressions before returning the resulting left subtree to expr the next example is more complexbut follows the same rulesp parse(' ( )'[+ [* [+[* trees are made of nested class instances from an oop perspectiveit' another way to use composition since tree nodes are just class instancesthis tree could be created and evaluated manuallytooplusnodenumnode( )timesnodenumnode( )plusnodetimesnode(numnode( )numnode( ))numnode( ))apply({}but we might as well let the parser build it for us (python is not that much like lispdespite what you may have heardcustom language parsers