<insert original title here>

Programming, Haskell, and games

Posts Tagged ‘Haskell interpreter

cfopu, a minimalistic esoteric language similar to brainfuck and Assembly language

leave a comment »

cfopu is a primitive, minimalistic language, similar to assembly and brainfuck. It can read input from stdin, and print to stdout. When a file is interpreted, its contents are placed in memory after being processed by the preprocessor.
There are two pointers: the data pointer, and the instruction pointer, both of which initially point to the first byte. Each byte is parsed, the instruction pointer is set ahead by one byte, and then the command is executed if the byte is a command. There are only 8 primitive commands:

0: End the program.
1: Print current byte.
2: Get one character (blocking, if necessary). If EOF has been reached, the data pointer is set behind by one.
3: Set the data pointer behind by one.
4: Set the data pointer ahead by two.
5: Decrement the value pointed to by the data pointer by one.
6: If the current byte is non-zero, the data pointer is set behind by one; otherwise, the data pointer is set forward by two.
7: Sets the instruction pointer to the data pointer.

Read the rest of this entry »

Advertisements

Written by bairyn

July 10, 2010 at 21:57