Home

Awesome

Width

Width is a stack-based esoteric programming language solely based on letter widths.

The only valid commands in Width are the letters of the alphabet, uppercase and lowercase. All other characters are stripped out of the source and ignored.

Letters are mapped to numbers based on their width. The following table shows how letters map to numbers.

#Letters
0i j l
1f r t I
2c k s v x y z J
3a b d e g h n o p q u L
4F T Z
5A B E K P S V X Y
6w C D H N R U
7G O Q
8m M
9W

Width is stack-based. It has a main stack, a counter, and a backburner (storage) stack. Each number, as outlined above, is interpreted according to the following rules:

#ActionDescription
0Whiledo block while counter > 0
1Endend current block; if not in a block, end program
2Commandvalue of 0 in commands list below
3Separatorno-op; mostly used to separate commands
4Integerpush base 10 number, using left side row titles (width numbers); terminated with original char
5Commandvalue of 1 in commands list below
6Commandvalue of 2 in commands list below
7Stringpush string literal; sets of 2 width numbers equate to index in printable ASCII string below; terminated with original char
8Ifif top of stack, do block
9Elseelse; if if reaches else before end, do block

An explanation of some of the actions follows.

String Literals

The following are the 97 characters that you can use in string literals. String literals are started with value 7, (letters GOQ). They expect sets of two letters, which create base-10 numbers. These base-10 numbers are the index in the below string of the current char. A string literal is terminated with the original char the started it, and then pushed to the stack.

!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n\t

where \n is a literal newline and \t is a literal tab.

For example, the following pushes the string Hello, World!:

GZiwWOwQROWIkilBAQWmkOCDmifG

The string starts with G. Each set of two letters in the string maps to a number 00-99, which maps to an index in the above string, as follows:

Zi = 40 = H
wW = 69 = e
Ow = 76 = l
QR = 76 = l
OW = 79 = o
Ik = 12 = ,
il = 00 =  
BA = 55 = W
QW = 79 = o
mk = 82 = r
OC = 76 = l
Dm = 68 = d
if = 01 = !

Number Literals

Number literals are formed very similarly to string literals. Note that you cannot push negative literals or float literals, only positive integers - you'll have to use commands (subtraction, negation, and/or division, see below) to form those.

Number literals are started with value 4 (letters FTZ). The following letters are read as a base-10 number, where each letter's value is its associated number above. A number literal is terminated with the original char the started it, and then pushed to the stack.

For example, the following pushes 435923785:

FZaXMsoOMAF

Commands

Commands interact with the main stack, with STDIN, with STDOUT, with the counter, and/or with the backburner stack.

Commands are formed using actions 2, 5, and 6. A (hopefully up-to-date) list of commands can be found in info.txt. A fully-up-to-date list of commands can be found in the commands dict in the interpreter.

In the info.txt page and in the commands dict, 2 maps to 0, 5 maps to 1, and 6 maps to 2. Think of ternary numbers, but allowing leading 0s.

Commands are formed by one to four letters in 2, 5, or 6 in a row. To separate sequential commands, use the no-op, 3.