CCWPL: An Esoteric Programming Language in Snap

CCWPL is a programming language I made.

Link to the project.

From the project definition:

Programming

===

Instructions:
0: Rotate the wheel counter-clockwise.
1: Execute the currently selected command.

Wheel:
1: No op.
2: Set the referenced boolean to true.
3: Add the referenced boolean to the cache.
4: Perform a logical NOR on the two booleans in the cache and store it to the location of the referenced boolean.
5: If the referenced boolean is true, skip the next instruction. Otherwise, move to the previous instruction.
6: Request input in the form of a boolean and store to the location of the referenced boolean.
7: Output the referenced boolean.
8: Increment the memory pointer.
9: Decrement the memory pointer.
10: Halt the program.

When the wheel is rotated CCW, the command index is decremented. It also wraps (if 0, set self to 10).

Cache:
Up to two booleans can be stored in the cache. If more are added, then the oldest one is removed to make place.

===

Memory

===

Memory in CCWPL is unbounded, like many other esoteric programming languages. That means it starts at just one boolean, but more can be added as the program calls for it.

===

Compiling

===

There is a reporter named 'CCWPL: i (x) to i (y)'. It is essentially an auxiliary programmer, reporting the amount of '0's required to turn from command 'x' on the wheel to command 'y'. This allows much faster programming.
Use the 'join' block and the custom reporter to program faster. Refer to the instructions on the wheel (I recommend keeping a small sheet with them on it so you can follow along).

===

Input

===

Input is accepted as a '1' (true) or '0' (false). Any other value and the program will not do anything.

===

Output

===

Running a CCWPL program is all local. The output takes the form of a list with the program itself as the first item, the memory as the second, the cache as the third, and the actual output as the fourth. Press space to input another program after running.

Here is an example program:

0000010000000001

It requests input from the user in the form of a boolean (true or false) and outputs the input.

I haven't actually tried to find out whether or not CCWPL is Turing complete, and I don't expect you to, either. The language was inspired by Whirl, another esoteric programming language (but it is Turing complete). If you're gonna program, I recommend using the 'turns i(x) to i(y)' block, it gets confusing keeping track of where you are on the wheel (though, not as confusing as Whirl).

CCWPL means "Counter Clock Wise Programming Language".

2 Likes

Strange.

Why not have an actual wheel as the sprite's costume so you can watch it turn?

Admittedly I was too lazy to implement some sort of visualization when I made the program, but it only took me a few minutes to add one in. Updated project

I edited this comment multiple times but I have another program (albeit simple).

00000100010000010010001000000000100000001

Takes two booleans (supplied by the user) and outputs the logical NOR of the two.

1 Like

Nice. I'm working on one called Thred2D

The "quine" example program is actually a cat, not a quine. A quine is a program that outputs its source code. A cat is a program that asks the user for input, then outputs it.

Also there's a bug: the output feature outputs a list full of weird things.

Yeah, I meant to type "cat" program, but I never got around to changing the name of the program.

But the output isn't actually a bug. I like to keep everything that went into the program visible, so here's whats in the list:

  1. The first item is the program you decided to run.
  2. The second item is a list containing memory. It starts off with just one boolean set to false, but can grow if needed.
  3. The third item is the cache. This is where logical operations (actually, just the NOR) are performed, the results of which are stored in the item in memory currently pointed to by the boolean.
  4. The fourth item is the actual output.

Maybe I should get rid of all the stuff and just show the output, but I'd rather not work on this programming language anymore. It's quite lazy and I'm not even sure if its Turing complete. For my next project I'd probably implement this programming language called "grass" but my previous two attempts have not been successful. Third time's the charm? Maybe...