-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
25 lines (20 loc) · 897 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
This is a yet-to-be-proved (I.e. I think it is) Turing complete Reverse
Polish Notation calculator
The language is quite simple:
* + -- add the top two operands
* - -- subtract the top two operands
* * -- multiply the top two operands
* ^ -- clear the top operand
* & -- Swap the top two operands
* $ -- duplicate the top two operands
* [ -- enter a loop if the top is not zero
* ] -- exit the loop
* ? -- skip an instruction if the top is not zero
* ! -- print debugging information
* , -- store at the addr on the top of the stack, the next value on the stack
* . -- load from the addr at the top of the stack.
Notable bugs:
* Whitespace: It hates white space
* Input strings containing ?] have the potential to cause a memory leak
* It will parse strings like "A2+" to (65-48) + 2. The -48 is because of
shifting to get a numerical value for ascii chars 1-0