Rip — a stack-based rip language
All stack items are signed bigints.
0-9
: push valueP
: popS
: swapD
: duplicatei
: incrementd
: decrementr
: pops the number of items to rotate anti-clockwise ("insert")R
: pops the number of items to rotate clockwise ("extract")l
: push length of stack (before this push)a
s
m
q
M
p
:+
-
*
/
%
^
(add, subtract, multiply, quotient (integer), modulo, power)G
L
E
: greater, less, equal; booleans are 1 and 0, as you expectn
: not; equivalent to 0E[ ... ]
: syntactical; a codeblockI
: 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 charO
: outputs the top value as a numberg
: gets a character and pushes the ascii valueC
: open a socket connection to specified ip address, in 32- or 128-bit format for ipv4 or ipv6 resp., and port. Returns identifierw
: takes identifier and char; writes char to specified socket (leaves socket on stack)t
: takes identifier; takes char from specified socket and pushes it (leaves socket on stack)c
: takes identifier; closes that connectionF<bla>[code]
: define a function named "bla" with the body "code"<bla>
: call the function named "bla"$
: outputs a stackdump- whitespace: nop
'c
: pushes the ascii value of c"abcde"
:'a'b'c'd'e
#<file.rip>
: literally includes contents of 'file.rip' in-place
Any error causes the interpreter to exit, saying "rip".
Example code
Fibonacci:
01
1W[
DO
9io
D3ra
1]
Cat:
gDiW[ogDi]