Woefully
Woefully is a programming language based on lines made of spaces. It uses a unique type of control flow, featuring no explicit conditionals, and is believed TC, though it is too much of a tarpit to have a prime checker yet.
Basics
Before we talk what's in a program, let's talk about what's not. There are no characters but newlines, pipes, and spaces. There are no spaces next to newlines, or newlines next to spaces etc. Programs that have these will produce output "confuse :(".
On the program, there are two pointers: char pointer, and instruction pointer. The CP (char pointer) starts at the first char, and the IP starts at the CP. The ip moves across the lines until it finds a space; if there is no space on the current line, it will try the next line, etc. The top line is considered next to the bottom line for these purposes. Note that a program with no spaces produces the output "confuse :(". Once it finds a space, it will try to navigate down it as a path. navigation works like this: it checks if there is a space in the three adjacent squares below it:
# /|\
If there is, it will go to the first one there. if there is not, it halts the program.
It will keep going in this direction, until there are no spaces in that direction anymore:
(lines denote the spaces it checks) # /|\ / / (line end)|\ | /|\ (no more spaces near this space)
When it finds the end of the line in that direction, it executes a command based on the path length. If the length is 2, it is a nop. if it is greater than 2, execute a command (see below).
When the entire path ends, as in the example above, after the line ends, the IP is set to the CP's position.
Stacks
There are two stacks, A and B.
Stacks start initialised with a single zero.
Stack A is the main stack, and stack B is very much a secondary place to store data temporarily. All push commands are to A, except dupe and A to B.
Commands
All two length commands are nops.
Commands subtract three because the minimum length of a command is three, because length two is a nop.
DDL (diagonally down left)
Path length is taken, minus three, pushed to stack A.
DOWN
Path length is taken, minus three, mod 4, then looked up in this table:
Name | What it does | |
---|---|---|
0 | AtoB | pop a from A, push a to B |
1 | diff | pop a from A, b from B, push a-b to A |
2 | mult | pop a from A, b from B, push a*b to A |
3 | dupe | peek a from A, push a to B |
DDR (diagonally down right)
Take the length of a DDR path, subtract three, mod 5, then look up in this table.
Moving works with negative integers; it moves back. Moving wraps at the line, and moves down a line, like regular text. It also wraps at the end, to the start.
Name | What it does | |
---|---|---|
0 | move | pop a from A, move pointer by a |
1 | bool | pop a from A, push 1 if a!=0, else 0 |
2 | inpt | push input to A |
3 | otpt | pop a from A, print a |
4 | swap | swap decimal/text i/o (text supports utf-8) |