From f46e00474498c5377d3aa050507466fc377bced5 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 17 Dec 2015 20:30:04 +0100 Subject: fix readme --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ rip-lang.txt | 51 --------------------------------------------------- 2 files changed, 54 insertions(+), 51 deletions(-) create mode 100644 README.md delete mode 100644 rip-lang.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..cad48d7 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +Rip — a stack-based rip language +================================= + +All stack items are signed bigints. + +- `0-9`: push value +- `P`: pop +- `S`: swap +- `D`: duplicate +- `i`: increment +- `d`: decrement +- `r`: pops the number of items to rotate anti-clockwise +- `R`: pops the number of items to rotate clockwise +- `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 expect +- `n`: not; equivalent to 0E +- `[ ... ]`: 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 +- `F[code]`: define a function named "bla" with the body "code" +- ``: call the function named "bla" +- `$`: outputs a stackdump +- whitespace: nop +- `'c`: pushes the ascii value of c +- `#`: 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: + +``` +gD0dEnW[ogD0dEn] +``` diff --git a/rip-lang.txt b/rip-lang.txt deleted file mode 100644 index 60ba5e5..0000000 --- a/rip-lang.txt +++ /dev/null @@ -1,51 +0,0 @@ -Rip -- a stack-based rip language -================================= - -All stack items are signed bigints. - -0-9: push value -P: pop -S: swap -D: duplicate -i: increment -d: decrement -r: pops the number of items to rotate anti-clockwise -R: pops the number of items to rotate clockwise -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 expect -n: not; equivalent to 0E -[ ... ]: 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 -F[code]: define a function named "bla" with the body "code" -: call the function named "bla" -$: outputs a stackdump -whitespace: nop - -'c: pushes the ascii value of c -#: 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: - -gD0dEnW[ogD0dEn] -- cgit v1.2.3-54-g00ecf