Doug

From Esolang
Jump to navigation Jump to search

Doug is an Arch-based esoteric programming language made by Areallycoolusername. All commands are meant to be a quote by Fairly Oddparents' "Doug Dimmadome", and follow the P" (P Double Prime) language syntax.

Specifics

As stated before, all commands follow the P Double Prime language syntax, which is defined as follows, paraphrased from Wikipedia:

  1. Doug, Dimmadome, DougDimma, DomeDoug, DimmaDimmaDoug, etc. are words in Doug.
  2. If q1 and q2 are words in Doug, then q1q2 is a word in Doug.
  3. If q is a word in Doug, then (q) is a word in Doug.
  4. Only words derivable from the previous three rules are words in Doug.

Doug has the four basic commands needed for an arch, along with a host of other commands that can be used interchangeably and combined to describe new instructions. These are:

Command Function
"Timmy Turner my name is " Starts program
Doug x Points to cell position x
Dimmadome x Pushes x onto the arch
DougDimma Pops off value on the arch
DomeDoug x Splits current cell by x
DimmaDimmaDoug Prints values in current cell
DougDome x DomeDome y Inserts value y into variable x
DougDoug x,y Moves value in cell position x into cell position y.
DimmaDimma x DomeDimma y If x is true, then execute y
Dimma x Dome y...z DimmaDoug w For condition x in range y to z is true, execute w.

These commands can be used to manipulate data in the stack, give output, control flow of data, and loop. All programs must start with the command, "Timmy Turner, my name is ", followed by the programs code. Commands can be mixed to create new functions, as allowed by the P" syntax. For example:

Timmy Turner, my name is 
DougDimmadome 1,3

Pushes 3 onto the cell in position 1. This is equivalent to the program:

Timmy Turner, my name is 
Doug 1
Dimmadome 3

Which has the same function.

Pop, Print, and Split, and Move

So far, we have covered the command used to start the program, the use of mixing different instructions, the POINT command, Doug, and the PUSH command, Dimmadome. Now, we'll cover the POP, print, and SPLIT command in Doug. The POP command, DougDimma, must be used only after the pointer is initialized. This command Pops the value from the cell. The print command, DimmaDimmaDoug, prints the value in the current cell. It must be used after the initialization of the pointer. The Split command, DomeDoug, must be used after the initialization of the pointer, and be used with an integer following it. This integer can be either, 2, 4, or 8, and will be used to create smaller cells for more trivial operations. The move commad, DougDoug, will be used to move the value in cell x into cell y. It must be used after the initialization of the pointer, and is used to perform basic arithmetic. Here is an example of all the commands in a program.

Timmy Turner, my name is 
Doug 1
Dimmadome 3
DougDimma
Dimmadome 4

Doug 2
DimmaDome 5
DougDoug 1,2
DimmaDimmaDoug

Doug 3
DomeDoug 2

This points to cell 1, and pushes value 3 into it. Then, that value is popped, and replaced with value 4. The program then points to cell 2, and pushes 5 into it. The contents of cell 1 is moved to cell 2, and the result is printed. This prints 9. Finally, the program points to cell 3, and Splits it by 2, to create 2 cells with 32 bits of memory.

Variables, Ifs, and for

Varaiables in this language use the syntax, DougDome x DomeDome y, where x is the variable, and y is the value. This feature was implemented for use with the if statement and for loop, as well as to substitute instructions with variables to drastically shorten code, which makes it easier for code golf. It was also implemented to prevent meaningless obfuscation, however, if you would prefer the extra difficulty, you can chose not to use variables in that way (it could be a lot more fun). The if statement follows the syntax, DimmaDimma x DomeDimma y, where x is the condition, and y is the body of the if statement. The for loop is the only loop in the language, so an effort was made to make its use fairely simple. The syntax for the for loop is, Dimma x Dome y...z DimmaDoug w. This is equivalent to:

for [x] in range [z] to [y]:
    [for body]

The range of all for loops are automatically inclusive. Here is an example using all of the features covered.

Timmy Turner, my name is 

Doug 1
DougDome I DomeDome 0
DimmaDimma I = 0
     Dimma J Dome 99...1
          Dimmadome J
          DimmaDimmaDoug
          DougDimma

This program declares the variable x, and gives it the value, 0. Then the if statement chacks if I is equal to 0. If it is, then the for loops Declares the variable J with a value in range 99 to 1. The program pushes J onto the arch, prints it, and pops the value to prepare for the next iteration. This program prints 99 to 1.

Hello World Program

This program utilizes variables to shorten command names for an easier to understand Hello World Program, and only uses 1 cell to further shorten it. It can be shortened even further through the the use of the P Double Prime syntax.

Timmy Turner, my name is 

DimmaDimma x DomeDome Dimmadome
DimmaDimma y DomeDome DougDimma
DimmaDimma z DomeDome DimmaDimmaDoug

Doug 1
x H
z
y
x e
z
y
x l
z
z
y
x o
z
y
x ,
z
y
x  
z
y 
x w
z
y
x o
z
y
x r
z
y
x l
z
y
x d
z
y
x !
z
y

Computational Properties

As Doug is arch based, it's not Turing complete. It is instead, a Bounded-storage machine.

Implementations

There are no implementations as of yet.