Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

rpn Build Status

An rpn calculator using no explicit stack, only recursion and function-passing (golang)

usage

Values are entered in reverse polish notation (rpn) order. Values entered are stored on a stack. When an operator is entered, it reaches backwards into the stack to find its arguments, and pushes its result onto the stack. For example, to add 1 and 2, first push 1 onto the stack, then push 2, then push the "+" operator, which takes the previous two values on the stack, 1 and 2, as its arguments:
1 2 +
will result in the stack:
3

syntax

###binary operators + addition
- subtraction
* multiplication
/ division
| bitwise or
& bitwise and

###unary operators c negation
~ bitwise not
dup duplicate the value on the top of the stack
(ie, 1 dup ==> 1 1)
pop pop the top value off of the stack and discard it
swap swap the top two values on the stack
zero pop and discard all values on the stack
print print the top value on the stack

###other quit quit

About

An rpn calculator using no explicit stack, only recursion and function-passing (golang)

Resources

License

Releases

No releases published

Packages

No packages published

Languages