CALC                                                      (C)1997 Matt Sephton
Expression Evaluator                                         Tektonix Software
------------------------------------------------------------------------------

Usage: CALC expression [/V]
   eg. CALC 5*(2+3)-2/1

------------------------------------------------------------------------------
OVERVIEW

CALC is a simple expression evaluator (calculator?) for use from the DOS
prompt. Output can be redirected another command through use of a pipe (|) and
to a file through use of redirection symbols (< >).

It accepts expressions in infix (normal) notation, whilst converting and
storing them internally in postfix (reverse polish) notation for greater speed
and ease of calculation.

As well as expressions, you can simply pass an integer number on the command
line to have it's equivalent displayed in other supported bases.

------------------------------------------------------------------------------
OPTIONS

Switches can also be entered along with the expression on the command line.
They are not case sensitive and are listed below. They must be preceded, as is
usual, by the normal switch character (/).

/V      Verbose mode.
        Result in decimal along with hexidecimal and octal (if integer result).

------------------------------------------------------------------------------
SUPPORT

CALC supports the following features (in order of precedence):

 0.9        decimal numbers (including decimal point)
  ()        brackets
   +        addition
   -        subtraction
   *        multiplication
   /        divison
   ^        power

It may be worth noting that a period (.) is used as the decimal point and any
commas (,) used as thousand separators are ignored, as are any spaces.

------------------------------------------------------------------------------
INCLUDE calc.e

CALC is now a single, includable .e file and so can be used in any of your own
Euphoria programs. All I ask is that you give me credit in your program and in
its documentation. Thank you.

------------------------------------------------------------------------------
ERROR MESSAGES

When an error occurs the DOS error level is set and the program exits
with an appropriate message. These are:

LEVEL  MESSAGE
  0    Successfull evaluation.

  1    Usage: CALC expression [/V]
          eg. CALC 5*(4+3)-2/1

  2    Invalid symbol found
       5*(2&3)-2/1
           ^
  3    Invalid internal expression
       Please report to u5ms@csc.liv.ac.uk!

  4    Attempt to divide by 0

------------------------------------------------------------------------------
FUTURE

In the future complexity may grow to support such features as:

   !    factorial                ln    logarithm (base e)
   -    negation                log    logarithm (base 10)
   #    hexidecimal numbers     mod    modulus (remainder)
 sin    sine                     pi    pi (a constant)
 cos    cosine                    e    e (a constant)
 tan    tangent                        and more...

------------------------------------------------------------------------------
AUTHOR

Feedback on the program would be appreciated. I can be contacted by e-mail,
or you can visit my web page to get the latest version and more.

        Matt Sephton
        u5ms@csc.liv.ac.uk
        http://www.csc.liv.ac.uk/~u5ms/

CALC was written in an excellent new programming language called Euphoria. For
more information see the official Euphoria homepage, a link to which is at:

        http://www.csc.liv.ac.uk/~u5ms/Euphoria/

------------------------------------------------------------------------------
HISTORY

4-7.4.97  Development.

8.4.97    First public release. Supports ()+-*/^ operators.

25.4.97   Divide by zero error trapped, includable.

