Single Four

From Esolang
Jump to navigation Jump to search

Single Four is an esoteric programming language created by Starla Insigna. It was designed to be extremely difficult (if not impossible) to program with.

Instructions

Single Four has only three legal instructions.

  • - - Comment character. Anything following the comment character is ignored.
  • (Space) - Separation character.
  • 4 - Everything else.

A line of Single Four code consists of a function call and a space-delimited list of arguments. Functions in Single Four are all referenced by a number and all variables are number-referenced as well. However, the only number you are allowed to use is 4 (44, 444 and so on are also allowed) and neither the function IDs nor the variable IDs follow that rule.

This makes programming with Single Four a huge challenge as the only functions immediately available to you are 4 and 44. However, with some thought, a simple program can be written using only those two functions, because function 44 means "call the function whose ID is stored in the variable whose ID is the first argument with the argument after the first argument".

There are 21 defined functions in the Single Four language. There is a link to a list of functions below, in the External resources section.

An example of a line of Single Four code is as follows. The following code divides (function 4) 4 by 4 (the first two arguments) and store it in variable 4 (the last argument):

4 4 4 4

Every Single Four program must be terminated by calling function 0. However, you are only allowed to use 4 and 44. This is how you terminate a Single Four program only using the legal instructions:

4 4 44 44 - Divide four by forty-four (which, in integer division, is zero) and store it in variable 44
44 44 - Call the function whose ID is in variable forty-four, in this case zero, so terminate the program

Example

The only known program written in Single Four is the Hello World program. This program is 485 lines of code long, so it will not be reproduced here, instead, a link to it is provided below in the External resources section.

External resources