Rhokell

rhokell created by User:Pro465 is a mixture of rho calculus + haskell. it consists of a list of rules separated by ;, each consisting of two untyped expressions separated by =. 
it reduces greedily/applicative-order-ly. that means arguments are reduced before their functions. more specifically, for any expression (a b), 
# first a is reduced, 
# then b, 
# and finally (a b). 
it also always applies the first match that is found, unlike haskell (which just throws an error). 
example of peano addition:
(add (z) y) = (y);
(add (s x) y) = (s (add x y));
(yes I know it looks like lisp, but that's purely coincidental)
note that the pattern is required to not be just a variable, so we cannot write:
x = (s x);
== Explanation ==
=== normal vs REPL vs RD mode ===
In normal mode, the interpreter calls the (main) function if it is defined, and runs it. 
In REPL mode, the interpreter evaluates an expression given by the user, and prints the resulting expression in a loop. 
In RD (ResultDisplay) mode, the interpreter calls the (main) function if it is defined, and runs it. Then it prints the resulting expression. 
The normal mode is required, while the REPL and RD modes are optional for any implementation.
=== Difference between variable and function names ===
first off, (a b c) is syntax sugar for (((a) b) c). secondly, an identifier is a group of contiguous alphanumeric unicode characters. OK, now we can talk.
the difference between a variable (that matches anything) and a function (that only matches itself) in the pattern side is easy:
* If an expression is of the form (f) where f is an identifier, then f is a function name. 
* If, however, it is of the form (f v), where v is an identifier, then v is a variable name. 
in other words, an identifier in argument position is a variable. otherwise, it's a function name.
However, in the replacement side (the RHS of the =), things are a bit more complex: what might seem to be "function names" can turn out to be actually variables when their name is bound to a variable in the pattern (the LHS). for example:
(if e1 e2 arg (F)) = (e2 arg);
here, even though e2 appears to be a function name, it is actually a variable due to being bound by the e2 in the pattern. If, however, e2 did not appear in the pattern, it would really be a function name much like if or F.
=== Data types ===
there are no data types. Instead data types are emulated by functions with no defined rules, like s x, or (cons a list).
=== I/O ===
==== byte "data type" ====
a (byte (a) (b)) represents a byte with its upper and lower half being a and b respectively. a and b are in hexadecimal. so it means 0x{a}{b} in other programming languages. For example: (byte (6) (F)) means 0x6F, which corresponds to the character 'o' in ascii.
==== Functions for I/O ====
two function names are special for I/O operations: input and output
* (input) - reduces to the next byte given in standard input in the form of (byte (a) (b)). If there are no more bytes left, reduces to (EOF).
* ((output) (byte (a) (b))) - reduces to (output), while printing the byte to standard output. if the argument given is not of the form for byte given above, it does not print anything.
== Examples ==
=== text to cons list ===
open in REPL mode, type (tr), press enter, then give input.
(tr) = (transform (input));
(transform (byte (0) (A))) = (cons (byte (0) (A)) (nil));
(transform x) = (cons x (transform (input)));
=== Peano multiplication and exponentiation ===
works only in repl mode
(add (z) y) = (y);
(add (s x) y) = (s (add x y));
(mul (z) y) = (z);
(mul (s x) y) = (add y (mul x y));
(exp x (z)) = (s (z));
(exp x (s y)) = (mul x (exp x y));
=== Hello, world! ===
Made with the help of the "text to cons list" program above.
(main) = (print 
 (cons (byte (4) (8)) # "H"
 (cons (byte (6) (5)) # "e"
 (cons (byte (6) (C)) # "l"
 (cons (byte (6) (C)) # "l"
 (cons (byte (6) (F)) # "o"
 (cons (byte (2) (C)) # ","
 (cons (byte (2) (0)) # " "
 (cons (byte (7) (7)) # "w"
 (cons (byte (6) (F)) # "o"
 (cons (byte (7) (2)) # "r"
 (cons (byte (6) (C)) # "l"
 (cons (byte (6) (4)) # "d"
 (cons (byte (2) (1)) # "!"
 (cons (byte (0) (A)) # "\n"
 (nil))))))))))))))));
(print (cons x y)) = (then (output x) (print y));
(then a b) = b;
=== Truth Machine ===
(main) = (a (input) (output));
(a (byte (3) (0)) o) = (o (byte (3) (0)));
(a x o) = (a x (o x));
=== Cat ===
(main) = (cat (input) (output));
(cat (EOF) o) = (do_nothing);
(cat x o) = (cat (input) (o x));
=== Reverse cat ===
(main) = (print (reverse (collect (input))));
(collect (EOF)) = (nil);
(collect b) = (cons b (collect (input)));
(print (cons x y)) = (then (output x) (print y));
(reverse (nil)) = (nil);
(reverse (cons x y)) = (append (reverse y) (cons x (nil)));
(append (nil) x) = x;
(append (cons x y) z) = (cons x (append y z));
(then a b) = b;
=== Kolakoski sequence ===
uses O(log n) space and O(n) time to print to nth term.
# this implements a minor variant of the algorithm given here:
# https://www.emis.de/journals/JIS/VOL15/Nilsson/nilsson5.pdf
#
# specifically, instead of initializing P[k] with "22" before 
# carrying out the increment logic, 
# it simply returns after "setting" it to "2".
# first print "1, 2, " 
(main) = (kolakoski (then (print (1) (2)) (nil)));
(kolakoski x) = (kolakoski (print_next (inc x)));
(inc (nil)) = (cons (2) (nil));
(inc (cons (t a) b)) = (cons a b);
(inc (cons a b)) = (repeat (inc b) (next a));
(repeat (cons a b) sym) = (cons (times (get a) sym) (cons a b));
(times (1) s) = s;
(times (2) s) = (t s);
(get (t b)) = b;
(get b) = b;
(next (1)) = (2);
(next (2)) = (1);
(print_next (cons a b)) = (then (print (get a)) (cons a b));
(print a) = (then (o (3) a (2) (C) (2) (0)) (print));
(o a b) = (then (output (byte a b)) (o));
(then a b) = b;
=== Quine ===
Warning: looong code wall incoming
(data) = (c (3) (B) (c (0) (A) (c (2) (8) (c (6) (D) (c (6) (1) (c (6) (9) (c (6) (E) (c (2) (9)
(c (2) (0) (c (3) (D) (c (2) (0) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (8) (c (6) (4) (c (6) (F) (c (2) (0) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (2) (c (6) (5)
(c (6) (6) (c (6) (F) (c (7) (2) (c (6) (5) (c (5) (F) (c (6) (4) (c (6) (1) (c (7) (4)
(c (6) (1) (c (2) (9) (c (2) (0) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9)
(c (6) (E) (c (7) (4) (c (5) (F) (c (6) (4) (c (6) (1) (c (7) (4) (c (6) (1) (c (2) (0)
(c (2) (8) (c (6) (4) (c (6) (1) (c (7) (4) (c (6) (1) (c (2) (9) (c (2) (0) (c (2) (8)
(c (7) (A) (c (2) (9) (c (2) (0) (c (2) (8) (c (7) (A) (c (2) (9) (c (2) (9) (c (2) (0)
(c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F)
(c (6) (3) (c (6) (F) (c (6) (4) (c (6) (5) (c (2) (0) (c (2) (8) (c (6) (4) (c (6) (1)
(c (7) (4) (c (6) (1) (c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (9) (c (3) (B) (c (0) (A) (c (0) (A) (c (0) (A) (c (2) (8) (c (6) (2)
(c (6) (5) (c (6) (6) (c (6) (F) (c (7) (2) (c (6) (5) (c (5) (F) (c (6) (4) (c (6) (1)
(c (7) (4) (c (6) (1) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (0) (A) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (6) (C)
(c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (0) (c (2) (8)
(c (3) (6) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (4) (c (2) (9) (c (2) (0) (c (2) (8)
(c (3) (6) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (1) (c (2) (9) (c (2) (0) (c (2) (8)
(c (3) (7) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (4) (c (2) (9) (c (2) (0) (c (2) (8)
(c (3) (6) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (1) (c (2) (9) (c (2) (0) (c (2) (8)
(c (7) (2) (c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (0)
(c (2) (8) (c (7) (3) (c (7) (0) (c (6) (1) (c (6) (3) (c (6) (5) (c (2) (9) (c (2) (0)
(c (2) (8) (c (3) (3) (c (2) (9) (c (2) (0) (c (2) (8) (c (4) (4) (c (2) (9) (c (2) (0)
(c (2) (8) (c (7) (3) (c (7) (0) (c (6) (1) (c (6) (3) (c (6) (5) (c (2) (9) (c (2) (9)
(c (3) (B) (c (0) (A) (c (0) (A) (c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9)
(c (6) (E) (c (7) (4) (c (5) (F) (c (6) (4) (c (6) (1) (c (7) (4) (c (6) (1) (c (2) (0)
(c (7) (8) (c (2) (0) (c (2) (8) (c (7) (3) (c (2) (0) (c (2) (8) (c (7) (3) (c (2) (0)
(c (2) (8) (c (7) (3) (c (2) (0) (c (2) (8) (c (7) (3) (c (2) (0) (c (2) (8) (c (7) (3)
(c (2) (0) (c (2) (8) (c (7) (3) (c (2) (0) (c (2) (8) (c (7) (3) (c (2) (0) (c (2) (8)
(c (7) (3) (c (2) (0) (c (2) (8) (c (7) (A) (c (2) (9) (c (2) (9) (c (2) (9) (c (2) (9)
(c (2) (9) (c (2) (9) (c (2) (9) (c (2) (9) (c (2) (9) (c (2) (9) (c (2) (0) (c (3) (D)
(c (2) (0) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (4)
(c (6) (F) (c (2) (0) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (3) (0)
(c (2) (9) (c (2) (0) (c (2) (8) (c (4) (1) (c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8)
(c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (4) (c (6) (1)
(c (7) (4) (c (6) (1) (c (2) (0) (c (7) (8) (c (2) (0) (c (2) (8) (c (7) (A) (c (2) (9)
(c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (3) (0) (c (2) (9)
(c (2) (0) (c (2) (8) (c (4) (1) (c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (9) (c (3) (B) (c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2)
(c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (4) (c (6) (1) (c (7) (4) (c (6) (1)
(c (2) (0) (c (2) (8) (c (6) (3) (c (2) (0) (c (7) (7) (c (2) (0) (c (7) (8) (c (2) (0)
(c (7) (9) (c (2) (9) (c (2) (0) (c (7) (A) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0)
(c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (4) (c (6) (F)
(c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (6) (C) (c (7) (0) (c (6) (1)
(c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (6) (c (2) (9)
(c (2) (0) (c (2) (8) (c (3) (3) (c (2) (9) (c (2) (0) (c (2) (8) (c (7) (3) (c (7) (0)
(c (6) (1) (c (6) (3) (c (6) (5) (c (2) (9) (c (2) (0) (c (2) (8) (c (6) (C) (c (7) (0)
(c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8)
(c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (8) (c (6) (5)
(c (7) (8) (c (2) (0) (c (7) (7) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0)
(c (2) (8) (c (7) (2) (c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9)
(c (2) (0) (c (2) (8) (c (7) (3) (c (7) (0) (c (6) (1) (c (6) (3) (c (6) (5) (c (2) (9)
(c (2) (0) (c (2) (8) (c (6) (C) (c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E)
(c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E)
(c (7) (4) (c (5) (F) (c (6) (8) (c (6) (5) (c (7) (8) (c (2) (0) (c (7) (8) (c (2) (9)
(c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (7) (2) (c (7) (0) (c (6) (1)
(c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (0) (c (2) (8) (c (7) (3) (c (7) (0)
(c (6) (1) (c (6) (3) (c (6) (5) (c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (7) (0)
(c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (4) (c (6) (1) (c (7) (4)
(c (6) (1) (c (2) (0) (c (7) (9) (c (2) (0) (c (2) (8) (c (7) (3) (c (2) (0) (c (7) (A)
(c (2) (9) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (7) (2)
(c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (9) (c (0) (A)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (9) (c (3) (B) (c (0) (A) (c (2) (8)
(c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (4) (c (6) (1)
(c (7) (4) (c (6) (1) (c (2) (0) (c (2) (8) (c (6) (E) (c (2) (9) (c (2) (9) (c (2) (0)
(c (3) (D) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (6) (C) (c (7) (0)
(c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (6)
(c (2) (9) (c (2) (0) (c (2) (8) (c (4) (5) (c (2) (9) (c (2) (0) (c (2) (8) (c (7) (2)
(c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5) (c (6) (E) (c (2) (9) (c (2) (9) (c (3) (B)
(c (0) (A) (c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4)
(c (5) (F) (c (6) (3) (c (6) (F) (c (6) (4) (c (6) (5) (c (2) (0) (c (2) (8) (c (6) (3)
(c (2) (0) (c (7) (8) (c (2) (0) (c (7) (9) (c (2) (0) (c (7) (A) (c (2) (9) (c (2) (9)
(c (2) (0) (c (3) (D) (c (2) (0) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (8) (c (6) (4) (c (6) (F) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (7) (8)
(c (2) (0) (c (7) (9) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0)
(c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9)
(c (6) (E) (c (7) (4) (c (5) (F) (c (6) (3) (c (6) (F) (c (6) (4) (c (6) (5) (c (2) (0)
(c (7) (A) (c (2) (9) (c (0) (A) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (0) (c (2) (9)
(c (3) (B) (c (0) (A) (c (0) (A) (c (2) (8) (c (7) (3) (c (7) (0) (c (6) (1) (c (6) (3)
(c (6) (5) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (2) (c (2) (0)
(c (2) (8) (c (3) (2) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (0) (c (2) (9) (c (2) (9)
(c (3) (B) (c (0) (A) (c (2) (8) (c (6) (C) (c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5)
(c (6) (E) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (2) (c (2) (0)
(c (2) (8) (c (3) (2) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (8) (c (2) (9) (c (2) (9)
(c (3) (B) (c (0) (A) (c (2) (8) (c (7) (2) (c (7) (0) (c (6) (1) (c (7) (2) (c (6) (5)
(c (6) (E) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (2) (c (2) (0)
(c (2) (8) (c (3) (2) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (9) (c (2) (9) (c (2) (9)
(c (3) (B) (c (0) (A) (c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E)
(c (7) (4) (c (5) (F) (c (6) (8) (c (6) (5) (c (7) (8) (c (2) (0) (c (2) (8) (c (4) (1)
(c (2) (9) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0)
(c (2) (8) (c (3) (4) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (1) (c (2) (9) (c (2) (9)
(c (3) (B) (c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4)
(c (5) (F) (c (6) (8) (c (6) (5) (c (7) (8) (c (2) (0) (c (2) (8) (c (4) (2) (c (2) (9)
(c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8)
(c (3) (4) (c (2) (9) (c (2) (0) (c (2) (8) (c (3) (2) (c (2) (9) (c (2) (9) (c (3) (B)
(c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F)
(c (6) (8) (c (6) (5) (c (7) (8) (c (2) (0) (c (2) (8) (c (4) (3) (c (2) (9) (c (2) (9)
(c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (3) (4)
(c (2) (9) (c (2) (0) (c (2) (8) (c (3) (3) (c (2) (9) (c (2) (9) (c (3) (B) (c (0) (A)
(c (2) (8) (c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (8)
(c (6) (5) (c (7) (8) (c (2) (0) (c (2) (8) (c (4) (4) (c (2) (9) (c (2) (9) (c (2) (0)
(c (3) (D) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (3) (4) (c (2) (9)
(c (2) (0) (c (2) (8) (c (3) (4) (c (2) (9) (c (2) (9) (c (3) (B) (c (0) (A) (c (2) (8)
(c (7) (0) (c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (8) (c (6) (5)
(c (7) (8) (c (2) (0) (c (2) (8) (c (4) (5) (c (2) (9) (c (2) (9) (c (2) (0) (c (3) (D)
(c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (3) (4) (c (2) (9) (c (2) (0)
(c (2) (8) (c (3) (5) (c (2) (9) (c (2) (9) (c (3) (B) (c (0) (A) (c (2) (8) (c (7) (0)
(c (7) (2) (c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (8) (c (6) (5) (c (7) (8)
(c (2) (0) (c (2) (8) (c (4) (6) (c (2) (9) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0)
(c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (3) (4) (c (2) (9) (c (2) (0) (c (2) (8)
(c (3) (6) (c (2) (9) (c (2) (9) (c (3) (B) (c (0) (A) (c (2) (8) (c (7) (0) (c (7) (2)
(c (6) (9) (c (6) (E) (c (7) (4) (c (5) (F) (c (6) (8) (c (6) (5) (c (7) (8) (c (2) (0)
(c (6) (4) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (0)
(c (2) (8) (c (3) (3) (c (2) (9) (c (2) (0) (c (6) (4) (c (2) (9) (c (3) (B) (c (0) (A)
(c (0) (A) (c (2) (8) (c (6) (F) (c (2) (0) (c (2) (8) (c (6) (2) (c (2) (0) (c (7) (8)
(c (2) (0) (c (7) (9) (c (2) (9) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8)
(c (6) (F) (c (2) (0) (c (7) (8) (c (2) (0) (c (7) (9) (c (2) (9) (c (3) (B) (c (0) (A)
(c (2) (8) (c (6) (F) (c (2) (0) (c (7) (8) (c (2) (0) (c (7) (9) (c (2) (9) (c (2) (0)
(c (3) (D) (c (2) (0) (c (2) (8) (c (7) (4) (c (6) (8) (c (6) (5) (c (6) (E) (c (2) (0)
(c (2) (8) (c (6) (F) (c (7) (5) (c (7) (4) (c (7) (0) (c (7) (5) (c (7) (4) (c (2) (0)
(c (2) (8) (c (6) (2) (c (7) (9) (c (7) (4) (c (6) (5) (c (2) (0) (c (7) (8) (c (2) (0)
(c (7) (9) (c (2) (9) (c (2) (9) (c (2) (0) (c (2) (8) (c (6) (F) (c (2) (9) (c (2) (9)
(c (3) (B) (c (0) (A) (c (2) (8) (c (7) (4) (c (6) (8) (c (6) (5) (c (6) (E) (c (2) (0)
(c (6) (1) (c (2) (0) (c (6) (2) (c (2) (9) (c (2) (0) (c (3) (D) (c (2) (0) (c (6) (2)
(c (3) (B) (c (0) (A) (c (2) (8) (c (6) (4) (c (6) (F) (c (2) (0) (c (6) (1) (c (2) (9)
(c (2) (0) (c (3) (D) (c (2) (0) (c (2) (8) (c (6) (4) (c (6) (F) (c (2) (9) (c (3) (B)
(c (0) (A) (n))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))))
))))))));
(main) = 
 (do 
 (before_data) 
 (print_data (data) (z) (z)) 
 (print_code (data))
 );
(before_data) = 
 (o (lparen) (6) (4) (6) (1) (7) (4) (6) (1) (rparen) (space) (3) (D) (space));
(print_data x (s (s (s (s (s (s (s (s (z)))))))))) = 
 (do 
 (o (0) (A))
 (print_data x (z))
 (o (0) (A))
 );
(print_data (c w x y) z) = 
 (do
 (o (lparen) (6) (3) (space) (lparen))
 (print_hex w)
 (o (rparen) (space) (lparen))
 (print_hex x)
 (o (rparen) (space))
 (print_data y (s z))
 (o (rparen))
 );
(print_data (n)) = (o (lparen) (6) (E) (rparen));
(print_code (c x y z)) = 
 (do
 (o x y)
 (print_code z)
 );
(space) = (b (2) (0));
(lparen) = (b (2) (8));
(rparen) = (b (2) (9));
(print_hex (A)) = (o (4) (1));
(print_hex (B)) = (o (4) (2));
(print_hex (C)) = (o (4) (3));
(print_hex (D)) = (o (4) (4));
(print_hex (E)) = (o (4) (5));
(print_hex (F)) = (o (4) (6));
(print_hex d) = (o (3) d);
(o (b x y)) = (o x y);
(o x y) = (then (output (byte x y)) (o));
(then a b) = b;
(do a) = (do);
== See also ==
* Trep
* Treesolang
== Links ==
Github repo for the reference interpreter. also contains a smallfuck interpreter example, with unbounded memory, proving it's turing complete.
Category:2023
Category:Turing complete
Category:Turing tarpits
Category:Languages
Category:Implemented
Category:Functional paradigm
Category:Declarative paradigm 
Category:Graph-based
Category:Tree-based
Category:High-level