We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

CARP

From Esolang
Jump to navigation Jump to search

CARP stands for 'Canonian Analog Redstone Processor.' It is an esoteric programming language created by User:TheCanon2.

As the name implies, CARP is designed as a machine code for a hexadecimal Minecraft redstone computer.

Commands

CARP 1

CARP has fifteen 1-nibble (4-bit) registers with addresses 1 to 15. All CARP commands accept and require 2 operands, a register R and a line C. CARP has five commands.

Opcode Symbol Action
1 INC If the value at R is 15, goto C. Else, increment and move 1 line forward.
2 DEC If the value at R is 0, move 1 line forward. Else, decrement and goto C
3 CLR Set the value at R to 0 and move 1 line forward
4 OUT Output the value at R and move 1 line forward.
5 INP Accept an input and write it to R and move 1 line forward

Line numbers start at 1 and increment by 1 for each line in the program. Halting is done by forcing a jump to line 0, for the physical decoder only activates when it receives a non-zero signal strength.

Examples

Addition program

INC r3 2 # r3 is used for control flow
INP r1 3
INP r2 4
DEC r2 6
DEC r3 9
INC r1 7
INC r3 8
DEC r3 4
OUT r1 10
DEC r1 0

Computational class

CARP can simulate a two-register Minsky machine.

INC r1 2 Increment register 1

DEC r1 3 Decrement register 1 and jump to instruction 2 unless it is zero in which jump to instruction 3.

However, CARP is a bounded storage machine due to its limited cell width.