aboutsummaryrefslogtreecommitdiff
path: root/rip-lang.txt
blob: 0eb43b8c0bf1885fcc0c1012d02078b9d088756f (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Rip -- a stack-based rip language
=================================

All stack items are integers, of unspecified but constant size

0-9: push value
p: pop
s: swap
D: duplicate
i: increment
d: decrement
r: pops the number of items to rotate clockwise
R: pops the number of items to rotate anti-clockwise
+ - * /: just what you expect
> < =: comparisons; booleans are 1 and 0, as you expect
[ ... ]: syntactical; a codeblock
I: pops boolean, conditionally executing the codeblock that should follow the I, depending on the boolean (aka "if")
W: I, but then "while" instead of "if"
o: outputs the top value as an ascii char
O: outputs the top value as a number
g: gets a character and pushes the ascii value
S: outputs a stackdump
whitespace: nop


Any error causes the interpreter to exit, saying "rip".


Example code
------------

Fibonacci:

01
1W[
	DO
	9io
	D3r+
1]