title: Evaluating mathematical expressions in Python
body: <p>I want to tokenize a given mathematical expression into a parse tree like this:</p>
  
  <pre><code>((3 + 4 - 1) * 5 + 6 * -7) / 2
  
                            '/'
                          /     \
                         +        2
                      /     \
                    *         *
                  /   \     /   \
                 -     5   6     -7
               /   \
              +     1
            /   \
           3     4
  </code></pre>
  
  <p>Is there any pure Python way to do this? Like passing as a string to Python and then get back as a tree like mentioned above.</p>
  
  <p>Thanks.</p>