This is a simple lexical analyser that can evaluate expressions containing any combination of the following operators.
To have an expression evaluated, enter it at the command line and press ENTER/RETURN.
As with most terminal emulators, the up/down arrows can be used to navigate through previously entered expressions.
All operators use function notation.
That is, rather than writing "2 + 4", one must write "add(2, 4)".
Note that the nesting of operators is perfectly legal (ie. add(multiply(4, 2), factorial(3)) is a valid expression).
Here is a list of operators:
add(a, b): returns a + b
minus(a, b): returns a - b
multiply(a, b): returns a * b
divide(a, b): returns a / b
power(a, b): returns a ^ b
factorial(a): returns a!
Variables can be defined and then used in your expressions.
The syntax for variables is:
variable = expression
Names for variables must begin with either an upper case or lower case letter followed by
any combination of letters, numbers, underscores and single quotes.
expression -> number | variable | operator(expression,...)
operator -> add | minus | multiply | divide | power | factorial
number -> any numeric value
variable -> any variable name that has been assigned a value