Brainlisp
Jump to navigation
Jump to search
Paradigm(s) | Imperative |
---|---|
Designed by | User:Hakerh400 |
Appeared in | 2020 |
Computational class | Turing complete |
Major implementations | Interpreter |
File extension(s) | .txt |
Brainlisp is an experimental language designed as a simple test for Lisparser.
Overview
It has the following instructions (functions):
(left)
- Move memory pointer left(right)
- Move memory pointer right(inc)
- Increment memory cell(dec)
- Decrement memory cell(in)
- Read from stdin(out)
- Write to stdout(loop ...)
- Execute...
while memory cell is non-zero
Examples
Cat program
(in) (loop (out) (in))
Hello, World!
(inc) (loop (dec) (dec) (right) (dec) (loop (right) (right) (inc) (right) (dec) (dec) (dec) (dec) (dec) (left) (left)) (left) (dec) (dec) (left) (dec) (dec) (dec)) (right) (dec) (out) (right) (right) (right) (inc) (out) (right) (right) (out) (out) (inc) (inc) (inc) (loop (out) (right)) (left) (left) (left) (left) (out) (inc) (inc) (inc) (out) (dec) (dec) (dec) (dec) (dec) (dec) (out) (left) (left) (dec) (out) (right) (right) (right) (right) (inc) (out)
Truth-machine
(in)(out)(loop(loop(dec)(left)(inc)(right)(right)(inc)(left))(right)(dec))(left)(left)(left)(loop(left)(left))(right)(loop(out))