WCDA

From Esolang
Jump to navigation Jump to search

WCDA (acronym removed) is a golfing esoteric programming language made by User:SoundOfScripting. The specifics of the language are constantly changing, so it is hard to have an accurate description of all of its abilities. WCDA is built on the idea that it is community based; people can add whatever they want to it.

WCDA's command list is stored on User:SoundOfScripting's google drive at this page. The command list currently only supports the official Node.js interpreter (which has not been released yet).

Commands/instructions

WCDA programs (saved as a .wcda) are made of several one character commands. Commands can be made of any Unicode symbol. To add a command, one must comment a request for the command to be added, and the editors of the spreadsheet will add it if they see fit.
Commands in WCDA can use any Node.js module (which will be installed to the interpreter).

Execution

Execution of a WCDA program is determined by an instruction pointer, which may be modified by commands in the program. The program may also modify the distance that the instruction pointer moves after every command, which is by default 1 character.

//Anything past this point is going to changed or removed very soon.

Computational class

WCDA can interpret JavaScript and run any code possible in Node.js (see examples), therefore it is turing complete.

Example programs

Note: These examples may become outdated. If an example is not working or optimizable, please update it.

JavaScript interpreter (6 bytes)

S"IJ1j

How it works:

  • S - Sets the stack variable to an empty array
  • " - Sets the string variable to an empty string
  • I - Receives one line of input and stores it in the string variable
  • J - Executes the string variable as JavaScript code
  • 1 - Pushes 1 to the stack
  • j - Pops POS, jumps to POS (in this case jumps back to the " instruction)

In the official WCDA interpreter, it is possible to exit this program by typing "running=false" into the input prompt.

Full-line cat program (3 bytes)

"IO

How it works:

  • O - Prints the string variable to the console

Hello, World! (21 bytes)

"“Hello, World!”O

Cheated and golfed:

S"IJ1j

input: Javascript hello world program.

how it works:

  • “ - Reads the program until a ” and appends the in between string to the string variable.
  • Hello, World! - is not executed

Execute any JavaScript (n+8 bytes)

"“INSERT JAVASCRIPT HERE”J

Note: This example works as long as the ” symbol (end quote symbol, normal quotes are fine) is not used in the JavaScript code.
This example can use the ” symbol in the JavaScript code (n+22 bytes), not that you'd really want to.

S"“INSERT JAVASCRIPT UP UNTIL END QUOTE”p”‘“JAVASCRIPT AFTER END QUOTE”J

How it works:

  • p - Pushes the codepoint of the next character to the stack and skips it
  • ‘ - Pops A, appends the Unicode symbol corresponding to A (A is a code point) to the str variable.

Cheated 99 bottles of beer on the wall (276 bytes)

S"pc:'“ bottle(s) of beer on the wall,”O":'“ bottle(s) of beer.
Take one down, pass it around,”O"1\-:'“ bottle(s) of beer on the wall.”O":4\0≠“0 bottles of beer on the wall,
0 bottles of beer,
Go to the store, buy some more,
99 bottles of beer on the wall.”O

How it works:

  • : - Duplicate the top element of the stack
  • 0-9 - Push a decimal value on the stack
  • \ - Swaps the top two elements of the stack
  • ≠ - Pops A, B, and POS. If A ≠ B, it will jump to POS. Else, it will continue executing from the same spot.
  • - - Pops A,B, pushes A-B.
  • ' - Pops A, appends A to str variable as a number (i.e S"5'O will output 5, not a control character)
  • Note: The newlines in the program are a part of the strings. Do not forget them.

External resources