A Language Programmed While Listening to Godspeed You! Black Emperor

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

A Language Programmed While Listening to Godspeed You! Black Emperor is an esoteric programming language written by Eve in Rust, with similar behavior to the language FORTH. The goal of the language was to make it as annoying as possible to program in, with impractical and irritating design decisions. Nothing new there, really.

A Language Programmed While Listening to Godspeed You! Black Emperor has limited commands and follows an imperative programming paradigm. The data in the language is stored on a stack, with each element able to be an infinite array of characters or numbers.

There are two versions of A Language Programmed While Listening to Godspeed You! Black Emperor. There is an interpreter and a translator. The translator is considered legacy, as it has some bugs and is no longer supported. The translator would convert A Language Programmed While Listening to Godspeed You! Black Emperor code into C++ code, to be compiled and run on the command line.

Data Types

There are two data types in A Language Programmed While Listening to Godspeed You! Black Emperor:

bite:

A misspelling of byte, as it also acts as an 8 bit integer. To declare a bite, one would do the following:

bite 'c'﹔

Bites, despite acting as integers must be initialized and treated as chars. The code above would push a 99 onto the stack, as 99 is the ASCII value for c.


charms:

An inside joke. It acts as a singular char. To declare a charms, one would do the following:

charms 99﹔

Charms, despite acting as chars must be initialized and treated as 8-bit integers. The code above would push a 'c' onto the stack, as 99 is the ASCII value for c.


arrays:

Both types can be used as elements in arrays, and would be initialized as such:

bite 'a'. 'b'. 'c'﹔
charms 97. 98. 99﹔

Arrays can have infinite length.

Commands

A Language Programmed While Listening to Godspeed You! Black Emperor has the following commands:

Keyword Expected Arguments Description
comp Pops two variables off the stack. If their values are equal, it pushes a variable with a value of one. If not, the variable's value is zero.
difference Pops two variables off the stack. Subtracts the second variable popped from the first, then pushes a bite with the result.
dup Duplicates the top variable on the stack.
end Ends the loop or subroutine.
give up Does nothing. Must proceed up, or up will give an error
loop Performs a loop while the top value on the stack does not equal zero. Since the stack can be manipulated during the loop, it is the programmer's responsibility to make sure the stack's top value is the same as when the loop began.
print Pops then prints the top variable on the stack. If it is a charms or charms array, it is output as (an) ascii character(s). If it is a bite, it is output as (an) number(s).
product Pops two variables off the stack. Multiplies the first variable popped by the second, then pushes a bite with the result.
quotient Pops two variables off the stack. Divides the first variable popped by the second, then pushes a bite with the result.
read Prompts for user input, then pushes the input on to the stack as either a charms or charms array.
remainder Pops two variables off the stack. Mods the first variable popped by the second, then pushes a bite with the result.
skip bite Pops a variable off the stack. If the variable is not zero, it skips ahead (Argument) number of instructions.

Legacy note: Nested skips cannot jump to a place outside of the outer skip's bounds due to a translator bug.

sub charms UNIMPLEMENTED
sum Pops two variables off the stack. Adds the second variable popped to the first, then pushes a bite with the result.
swap Swaps the top two variables on the stack.
up Ends the program. Must be included. Must also be proceeded by the give keyword

Syntax

A Language Programmed While Listening to Godspeed You! Black Emperor requires the following syntactical rules be followed:

A ﹔, please note that it is not a ;, must end each statement.

When declaring arrays, elements must be separated by periods.

Examples

Hello World:

charms 72. 101. 108. 108. 111. 44. 32. 119. 111. 114. 108. 100. 33. 10﹔
print﹔
give up﹔

99 bottles of beer: (Please note that this example has some grammatical errors, these were done for the sake of brevity as charms arrays get very long very fast)

bite 'c'﹔
loop﹔
    dup﹔print﹔
    charms 32. 98. 111. 116. 116. 108. 101. 115. 32. 111. 102. 32. 98. 101. 
    101. 114. 32. 111. 110. 32. 116. 104. 101. 32. 119. 97. 108. 108. 44. 32﹔
    print﹔
    dup﹔print﹔
    charms 32. 98. 111. 116. 116. 108. 101. 115. 32. 111. 102. 32. 98. 101. 101.
    114. 33. 10. 84. 97. 107. 101. 32. 111. 110. 101. 32. 100. 111. 119. 110.
    44. 32. 112. 97. 115. 115. 32. 105. 116. 32. 97. 114. 111. 117. 110. 100. 44. 32﹔
    print﹔
    bite 'a'﹔
    bite 'b'﹔
    difference﹔
    swap﹔
    difference﹔
    dup﹔print﹔
    charms 32. 98. 111. 116. 116. 108. 101. 115. 32. 111. 102. 32. 98. 101. 101. 114.
    32. 111. 110. 32. 116. 104. 101. 32. 119. 97. 108. 108. 33. 10﹔
    print﹔
end﹔
give up﹔

Truth-machine: (Please note that this program was made before skip was implemented, and could be made shorter via skip)

charms 48﹔
read﹔
difference﹔
loop﹔
    charms 48﹔
    sum﹔
    dup﹔print﹔
    charms 48﹔
    swap﹔
    difference﹔
end﹔
charms 48﹔
sum﹔
print﹔
give up﹔

FizzBuzz: (Please note that this program does not work in the legacy translator)

bite 'd'﹔
dup﹔dup﹔difference﹔
swap﹔
loop﹔
    bite 'a'﹔bite 'b'﹔difference﹔
    swap﹔
    difference﹔
    swap﹔
    bite 'a'﹔bite 'b'﹔difference﹔
    sum﹔
    dup﹔
    bite 'a'﹔bite 'd'﹔difference﹔
    swap﹔
    remainder﹔
    skip 'A'﹔





























































    charms 70. 105. 122. 122﹔
    dup﹔
    print﹔
    skip 'f'﹔

    dup﹔
    bite 'a'﹔bite 'f'﹔difference﹔
    swap﹔
    remainder﹔
    skip 'A'﹔




























































    charms 66. 117. 122. 122﹔
    dup﹔
    print﹔
    skip ' '﹔

    dup﹔print﹔






























    charms 10﹔
    print﹔
    swap﹔
end﹔
give up﹔

See Also

External Resources