It's a simple parser that works like HP12C Financial Calculator.
Current implementation covers basically x,y,z registers and storage:
Basic operations like:
1
2
+ # => 3
See the code and examples.
1
2
+ # 3
+ # 5
1
2
+ # 3
5
+ # 8
Use sto <num>
to storage the x register on a memory with the index specified on num
.
1234
sto 1
rcl 1 # 1234
10
sto 1
20
sto 2
30
sto 3
rcl 1 # 10
rcl 2 # 20
rcl 3 # 30
As the example below, sto
command stores the X
and rcl
recovers from that.
You can make operations bringing storage through rcl <num>
command.
Where <num>
is the same memory index used with sto <num>
to get the value back.
123
sto 1
456
sto 2
rcl 2
rcl 1
- # 333
Try ruby hp12c.rb --repl
to play with it.