calc.icn: Program to simulate desk calculator

January 3, 1993; Ralph E. Griswold
This file is in the public domain.
This is a simple Polish "desk calculator".  It accepts as values Icon
integers, reals, csets, and strings (as they would appear in an Icon
program) as well as an empty line for the null value.

Other lines of input are interpreted as operations. These may be Icon
operators, functions, or the commands listed below.

In the case of operator symbols, such as +, that correspond to both unary
and binary operations, the binary one is used.  Thus, the unary operation
is not available.

In case of Icon functions like write() that take an arbitrary number of
arguments, one argument is used.

The commands are:

     clear   remove all values from the calculator's stack
     dump    write out the contents of the stack
     quit    exit from the calculator

Example: the input lines

     "abc"
     3
     repl
     write

writes abcabcabc and leaves this as the top value on the stack.

Failure and most errors are detected, but in these cases, arguments are
consumed and not restored to the stack.

Source code | Program Library Page | Icon Home Page