Implementation of the shunting-yard algorithm in C.
C C++
Latest commit 8beafe7 Nov 21, 2014 @bmars Fix comments and naming in stack files
Consistently use "item" instead of "element" or "node". Also, remove
comment about stack_pop returning NULL if empty; it just crashes.

README.md

This is a small command-line calculator that implements the shunting-yard algorithm to parse input. It's written in C and depends only on the C standard library.

Building from source:

$ autoreconf -i
$ ./configure
$ make

Using the calculator:

$ ./calc 1+2^3-4*5
-11
$ ./calc '3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3'
3.0001220703125
$ ./calc 'sin(pi)'
0

Multiple shell arguments are evaluated separately:

$ ./calc 1+2 '3+4 + 5+6' 7+8
3
18
15

A number of common math functions and constants are supported: abs(), sqrt(), ln(), lb(), lg() or log(), cos(), sin(), tan(), pi, tau, and e.