This forum is closed to new posts due to low activity and a deluge of spam. It is kept online as a static historical record. If you want to read about or discuss esoteric programming languages, the Esolang wiki is the place to go. An archive of the forum is available.

CAPS 4D - New Esolang (1)

1 Name: Brian M : 2011-10-09 01:17 ID:NAlmnpvH

I just made an esolang of my own (I was actually working on a very different esolang, but I got distracted and came up with this much simpler one instead).

I was wondering if I could get other people's opinions of it, possibly suggestions for improvement. (I don't hold out much hope given how little activity this board sees.)

Here it is

CAPS 4D. By Brian McPherson.


Tired of your standard Turing engine working sequentially in merely one-dimension? Is two dimensions in Funge too limited? Then look no further.

CAPS 4D gives you not one, not two, not even three but four... yes, FOUR wonderful dimensions to work in. When you write a program in CAPS 4D you not only choose what instructions to use, but you also choose how those instructions are laid out in four-dimensional memory space.

But that's not all, CAPS 4D is multi-tasking, capable of performing unlimited operations simultaniously. Pointers can self-duplicate and go on to duplicate themselves again, until swarms of wild pointers randomly roam the countryside, leaving chaos and mayhem in their wake.

It's instruction set is very simple. Just 26 instructons, one for each letter in the alphabet.

Writing a program

Program memory is arranged into a four-dimensional grid. To write a program with more than one dimension, you need to provide directions for how to map the instructions into memory space as well as the instructions themselves.

Instructions are mapped into memory by controlling a Data Pointer (DP) that begins at the "Home" position in the center of the grid with it's orientation facing "North". The orientation of a pointer will determine it's next position when it's moved forward (or backward). Orientation can be altered by rotating (or turning) the pointer.

The control-codes for mapping instructions into memory are:

Q = "turn left without moving"
W = "turn right without moving"
E = "turn up without moving"
R = "turn down without moving"
T = "turn in without moving" (forth dimension)
Y = "turn out without moving" (forth dimension)
X = "copy next character into memory and move forward one place"

Any other upper-case characters encountered will be automatically copied to memory, and DP moved forwrad one place.

To copy letters used for control-codes to memory, use X. For example, XQ will copy Q to memory, XW will copy W to memory, XE will copy E to memory, and so on. XX will copy X to memory. X is also used to copy non upper-case characters into memory.

After the program has been mapped into memory, the Data Pointer (DP) will no longer be in the home position, but the Instruction Pointer (IP) will still be at the home position when the program starts.

Loading a program

Before you can run a CAPS 4D program, the interpreter must first map the program into memory using the Data Pointer (DP) which should begin at "Home" facing "North".

Method for mapping program into memory from file:

Open file
If at end of file, stop mapping.
Load next byte from file
If byte NOT upper-case ASCII symbol, go to Start
If byte Q, rotate DP "left" and go to Start
If byte W, rotate DP "right" and go to Start
If byte E, rotate DP "up" and go to Start
If byte R, rotate DP "down" and go to Start
If byte T, rotate DP "in" and go to Start
If byte Y, rotate DP "out" and go to Start
If byte X, load next byte from file
Put byte into memory at DP location (overwriting anything there)
Move DP forward one place and go to Start

Note: The DP does NOT return home when this is done.
Remember: To copy Q, W, E, R, T, Y or X to memory, place X in front of them.

Comments can be inserted anywhere in the program as long as they contain no capital letters, and are not placed between an X and the character immediately following it.

Running the program

The Instruction Pointer (IP) starts at "Home", facing "North".
The Data Pointer (DP) remains where it was left after the program was mapped into memory (see above).

Whenever the IP is located at a memory address containing an upper-case ASCII symbol, the program carries out the command associated with that symbol, then advances the IP forward one place. When the IP is located at a memory address containing any other symbol, the IP is deactivated. When all IPs are deactivated, the program ends.

A cache capable of storing one byte also exists for each extant IP, and has an initial value of zero when the program starts.

When a "branch" command is encountered, identical duplicates of IP, DP and cache are generated, with the IP of the duplicate moved forward so that it skips the next command. (The next command would normally be a turn command, so the original moves in a different direction to the duplicate.)

When multiple active IPs exist, the program cycles through a list of IPs, executing and advancing each one in it's turn (every new IP is placed on the bottom of the list, meaning that if two IPs read/alter the same memory location during the same cycle, the newer IP will do so second).


(DP = Data Pointer, IP = Instruction Pointer.)

Q: DP turn left
W: DP turn right
E: DP turn up
R: DP turn down
T: DP turn in
Y: DP turn out
U: Move DP ahead one position
I: Move DP back one position
O: Increase byte at DP by one
P: Decrease byte at DP by one

A: IP turn left
S: IP turn right
D: IP turn up
F: IP turn down
G: IP turn in
H: IP turn out
J: Branch (Create another IP ahead of the next command)
K: Switch DP and IP (DP is now used as IP, and IP used as DP)
L: Make data a random value between zero and value held in cache (inclusive)

Z: Output one byte from memory at DP
X: Input one byte to memory at DP
C: Set byte at DP to zero
V: Copy byte at DP to cache
L: Add cache to byte at DP
N: If data = 0, move IP to location of earlier M, skip one M for each N encountered
M: If data = 0, move IP to location of later N, skip one N for each N encountered

For N and M, still move ahead 1 place after IP moves.
Data refers to the value of the byte located at DP
Branch command would normally be followed with a Turn command, so the two IP move in different directions.


Simple "Hello World" program:


Origin of CAPS 4D

CAPS 4D was invented 10/10/2011.

Having decided to invent an extremely innovative and creative esoteric programming language of my own, I spent several days and nights feverishly working on my masterpiece. While taking a break from this, I invented CAPS 4D. What, you expected an interesting story?

The ideas for a 4D memory space and branching Instruction Pointers, were entierly original. But it wouldn't surprise me if someone else had thought of these as well, because whenever I come up with an idea, there's usually lots of people who also thought of it years before me.

The idea for a language made entierly from capital letters came while viewing a page on QWERTYcode, but I took the basic commands from brainfuck. Because of this, a brainfuck program can be easily converted into CAPS 4D without much effort (a simple search-replace in a text editor will suffice).

Converting brainfuck programs to CAPS 4D

Substitute every instance of > with U
Substitute every instance of < with I
Substitute every instance of + with O
Substitute every instance of - with P
Substitute every instance of . with Z
Substitute every instance of , with XX
Substitute every instance of [ with N
Substitute every instance of ] with M


Name: Link:
Leave these fields empty (spam trap):
More options...