Skip to content

Instantly share code, notes, and snippets.

@UplinkCoder
Last active August 1, 2017 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UplinkCoder/002b31572073798897552af4e8de2024 to your computer and use it in GitHub Desktop.
Save UplinkCoder/002b31572073798897552af4e8de2024 to your computer and use it in GitHub Desktop.
brainfuck_helloworld as d-code
enum hello_world = (() {
uint iPos, oPos;
ubyte[] output;
output.length = 16;
ubyte[32] cells;
uint cellPtr = 0;
cells[cellPtr] += 10 ;
while(cells[cellPtr]) {
cellPtr += 1 ;
cells[cellPtr] += 7 ;
cellPtr += 1 ;
cells[cellPtr] += 10 ;
cellPtr += 1 ;
cells[cellPtr] += 3 ;
cellPtr += 1 ;
cells[cellPtr] += 1 ;
cellPtr -= 4 ;
cells[cellPtr] -= 1 ;
}
cellPtr += 1 ;
cells[cellPtr] += 2 ;
output[oPos++] = cells[cellPtr];
cellPtr += 1 ;
cells[cellPtr] += 1 ;
output[oPos++] = cells[cellPtr];
cells[cellPtr] += 7 ;
output[oPos++] = cells[cellPtr];
output[oPos++] = cells[cellPtr];
cells[cellPtr] += 3 ;
output[oPos++] = cells[cellPtr];
cellPtr += 1 ;
cells[cellPtr] += 2 ;
output[oPos++] = cells[cellPtr];
cellPtr -= 2 ;
cells[cellPtr] += 15 ;
output[oPos++] = cells[cellPtr];
cellPtr += 1 ;
output[oPos++] = cells[cellPtr];
cells[cellPtr] += 3 ;
output[oPos++] = cells[cellPtr];
cells[cellPtr] -= 6 ;
output[oPos++] = cells[cellPtr];
cells[cellPtr] -= 8 ;
output[oPos++] = cells[cellPtr];
cellPtr += 1 ;
cells[cellPtr] += 1 ;
output[oPos++] = cells[cellPtr];
cellPtr += 1 ;
output[oPos++] = cells[cellPtr];
return output[0 .. oPos];}
);
pragma(msg, cast(string) hello_world());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment