Next: , Up: Examples   [Contents][Index]

2.1 Reverse Polish Notation Calculator

The first example2 is that of a simple double-precision Reverse Polish Notation calculator (a calculator using postfix operators). This example provides a good starting point, since operator precedence is not an issue. The second example will illustrate how operator precedence is handled.

The source code for this calculator is named rpcalc.y. The ‘.y’ extension is a convention used for Bison grammar files.



The sources of rpcalc are available as examples/c/rpcalc.