derpcode

From Esolang
Jump to navigation Jump to search

derpcode is a tape-based esoteric programming language based on internet slang. derpcode consists of two objects: a one-ended tape of zero-initialized binary values, and a pointer.

Commands

derpcode has five commands, although an expansion to achieve Turing-complete status is planned.

Command Description
herp Flip the current bit.
derp Increment the pointer.
a-derp Decrement the pointer.
. Write the current bit and the next seven bits to stdout as an ASCII character.
? Set an ASCII character from stdin and store it in the current bit and the next seven bits.

All non-command symbols are ignored. Additionally, the two punctuation commands are ignored unless preceded by either another command or a whitespace character.

The tape is left-ended, and initializes with all zero-valued cells. A tape[-1] cell exists for structural purposes only.

A derpcode program is terminated by flipping the 0 cell, decrementing the pointer into the -1 cell, and executing the print command. The last line of all derpcode programs is therefore herp a-derp. In any other context, non-incrementing commands are ignored while on the -1 cell, so it's best not to go there.

Sample code

Hello world

derp a-derp.

derp herp derp derp derp herp a-derp a-derp a-derp a-derp. derp derp herp derp derp herp derp herp derp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp. derp derp derp derp herp derp derp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp. . derp derp derp derp derp derp herp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp.

derp herp derp derp derp herp derp herp derp herp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp. derp herp derp derp herp derp derp herp derp herp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp. derp derp derp herp derp herp a-derp a-derp a-derp a-derp. derp derp derp herp derp herp derp herp derp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp. derp derp derp herp derp herp derp herp derp herp a-derp a-derp a-derp a-derp a-derp a-derp.

derp derp derp derp herp a-derp a-derp a-derp a-derp. derp herp derp derp derp derp herp derp derp herp a-derp a-derp a-derp a-derp a-derp a-derp a-derp.

herp a-derp.

Implementation

A full implementation exists here, written by User:Conor O'Brien in node js.

A runtime interpreter written in Python is currently in development, and a compiler to C is planned.

External resources