This program aims to provide a simple example of parsing expressions by precedence climbing.
make
./calc
> 2 + 3 * 4
(2 + (3 * 4)) = 14.00
> (2 - 3) * 4
((2 - 3) * 4) = -4.00
> -2 ^ 2
-(2 ^ 2) = -4.00
> 2 ^ 2 ^ 3
(2 ^ (2 ^ 3)) = 256.00
> (10 * (350 + -25)) / 2
((10 * (350 + -25)) / 2) = 1625.00
> 100 + -2 ^ -(2 + 1) * 25
(100 + (-(2 ^ -(2 + 1)) * 25)) = 96.88
This source code is licensed under the GNU General Public License v3.0.