Juna
Jump to navigation
Jump to search
Juna is a esolang based on NAND logic. It uses a list of registers (one for each non-negative integer), each of which can store one bit and starts set to 0. Every line number is also a non-negative integer. Jumping to .
halts the program. Execution starts on line 0.
Syntax
Each line is 5 commands long and are in one of the following forms:
L a b Y N
- Line L: set register b to register a NAND b. If register b = 0, jump to line Y, else jump to line N
L . b Y N
- Line L: set register b to input. If register b = 0, jump to line Y, else jump to line N
L a . Y N
- Line L: output register a. If register a = 0, jump to line Y, else jump to line N
#
starts a comment that goes to the end of the line.
Examples
Example program: Truth-machine
0 . 0 1 2 #Set register 0 to inputted value. If it's 0, jump to line 1, else jump to line 2 1 0 . . . #Print register 0 (value 0), then halt 2 0 . 2 2 #Print register 0 (value 1), then repeat
Example program 2: "Hi" in binary (Hello, world! is too long :/)
0 1 1 1 1 #Set register 1 to 0 NAND 0 (1) 1 0 . 2 2 #Printing 2 1 . 3 3 3 0 . 4 4 4 0 . 5 5 5 1 . 6 6 6 0 . 7 7 7 0 . 8 8 8 0 . 9 9 9 0 . 10 10 10 1 . 11 11 11 1 . 12 12 12 0 . 13 13 13 1 . 14 14 14 0 . 15 15 15 0 . 16 16 16 1 . . .
Interpreter
- Common Lisp implementation of the Juna programming language.