DROL

From Esolang
Jump to: navigation, search

DROL (Double Register Optimization Language) is a simple single-character compiled language created by Bradley Sadowsky (User:BradleySadowsky). The compiler was released under the MIT License and written in Python 2.7.12. Everything in DROL is done by manipulating two virtual registers, Register One and Register two (somewhat similar to Deadfish). Each register has its own distinct set of commands. A key feature of DROL is its inability to handle errors: it simply ignores them.

Commands

Command Effect
x Exit program successfully
0 Do nothing
i,k Increment register by 1
d,e Decrement register by 1
o,p Display contents of register as number
a,b Display contents of register as ASCII character (if character is 0-255)
! Print newline to the screen
n,q Set register to user inputted number
z,y Set register to zero
1,2 Set both registers to the contents of register
s,u Set register to the sum of both registers
f,g Set register to the difference of both registers (always Register 1 - Register 2)
m,r Set register to the product of both registers
l,h Set register to the register squared
j If registers are equal execute the two commands immediately following `j', if not, execute the two commands after that
w While the registers are not equal, execute the next three commands (as a loop)
* Swap the contents of the registers
<,, Left shift register
>,. Right shift register
~,` Flip the bits in register
^,6 Set the register to both of the registers XORed
|,\ Set the register to both of the registers ORed
&,7 Set the register to both of the registers ANDed

Etymology of "DROL"

DROL (Double Register Optimization Language) refers to the existence of two registers, and the fact that it is a language. The optimization part of the acronym just sounded nice, as it is very far from an optimized way of doing things.

Implementations

Python Implementation

Currently, this is the only implementation. Written in Python, it translates DROL source into C code. It assumes GCC on the host system, although that can be easily changed in the source.

Sample Programs

Simple Single Register Hello World

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiaziiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiaziiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiaaziiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii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