alandipert / minirpn
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
Alan Dipert (author)
Sat Nov 14 21:25:26 -0800 2009
commit b33e7cac6de62df8ef2a6b38a802738cf016a9c5
tree fb03c13e62b5bdf9ee49265c9ccbb1ca2ca08dcd
parent dbd84a83d3700ace83d0bf7e880ee15c8d926149
tree fb03c13e62b5bdf9ee49265c9ccbb1ca2ca08dcd
parent dbd84a83d3700ace83d0bf7e880ee15c8d926149
minirpn /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
Makefile | ||
| |
README.markdown | ||
| |
TODO | ||
| |
lex.c | ||
| |
lex.h | ||
| |
rpn.c | ||
| |
stack.c | ||
| |
stack.h | ||
| |
tests.sh |
README.markdown
rpn - 4 function CLI RPN calculator
This is a small calculator in C for RPN calculating at the command line. Expressions are read from STDIN. Compile with make and run ./rpn to enter the REPL.
Usage
output
Prints 10, the value at the top of the stack.10 .addition
Prints 12, the sum of 10 and 2.10 2 + .subtraction
Prints 50.100 50 - .division
Prints 3.12 4 / .multiplication
Prints 9.3 3 * .
Note that you can 'peek' the top of the stack anywhere in an expression, ie:
1 2 + . 4 * . 5 + . 3 - .
Prints:
3
12
17
14

