documentation calc_tree

This paper gives further information on calc_tree - the data structure used for keeping track of the computing processes
in the basic calculator.

a calc_tree is a binary tree. every node has either none, one or two children. nodes with zero children are called leaves;
nodes with at least one children are referred to as (internal) nodes.

Internal Nodes represent arithmetic operations while leaves cover the numbers of the operation. Image the calculation
	1 + 3
Following the above definitions, this can be displayed as a tree in (only) two ways:
   +      +
  / \    / \
 1   3  3   1
By arrangement, a tree is constructed from left to right - therefore the above calculation would lead to the first tree.

A tree is subject of change while the user does the calculation. The smallest possible piece of information is named token.
A token is either
	- a bracket
	- or a number and a following operation
	
precedence:

So far, it is not obvious why using trees is an advantage. But when doing arithmetics, we have to pay attention to
precedence. E.g. in 3+4*5 we have to first multiply 4 by five and than add the result to 3. Trees give us the possibility
to observe precedence.

Remember that the operations are the nodes of our tree. Let current_node be the last node inserted into the tree and current_token
the number/operation pair to add. If the precedence of the current_token is greater than the one of the current_node, the operation
in current_token becomes the right child of current_token and the number the left child of this new node.
Otherwise, if precedence of current_node is greater or equal than the one of current_token, we follow the path from current_node
to the root of the tree as long as the precedence of the visited node is greater or equal the precedence of current_token. Insert
the operation either as new root (if all were greater or equal) or between the last node of greater or equal precedence and its
parent.

assume the following input to our calculator: 1-3^2*4+3/3= (the result is -34)
this input split up into tokens: 1-, 3^, 2*, 4+, 3/, 3=
these tokens joined to a tree:

1.  -	2.  -	3.  -	4.    +  5.     +    6.     +
   /       / \     / \       /        /   \       /   \
  1       1  ^    1  *      -	     -     /     -     /
            /       /      / \      / \   /     / \   / \
           3       ^      1  *     1  *  3     1  *  3   3
                  / \       / \      / \         / \
                 3   2     ^   4    ^   4 		^   4
						  / \      / \	  	   / \
						 3   2    3   2	 	  3   2
                 	 
of course, we won't build this tree first and do the computation at the end. Everytime, we insert a token of smaller precedence, 
we can reduce the tree by doing some computation. In step 1 and 2, no computation is possible. Bu e.g. in step 3 we could do
3^2 and replace the node ^ by the leave 9.

what we haven't treated yet are
- brackets (handled in a sub tree)
- right associativity of power (ev. call get_precedence with two arguments)!