I made an interpreter to test programs written in this little rpn language.
source: http://www.msu.edu/~shawjef3/lrpn.ml
windows binary: http://www.msu.edu/~shawjef3/lrpn.exe
Usage:
lrpn program stackval1 stackval2 ... stackvaln
For example, add 1 to each member of a 2-member stack.
lrpn 1+s1+s 5 6
yields:
6 7
Sometimes you will need to quote your program. For instance, "~1&" won't work on windows due to the shell thinking you are sending it commands. However quoting fixes that.
lrpn "~1&" 1
yelds 0, telling you that 1 is an odd number.
Friday, March 16, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment