M?!

From Esolang
Jump to navigation Jump to search

M?! is an esoteric programming language based on Brainfuck but with less commands:

Commands

Command Use
m Goes to the next mode (0>1>2>3>0)
? Mode 0: increment the current cell.

Mode 1: Moves the pointer right.

Mode 2: Starts a while loop.

Mode 3: Outputs the current cell as an ascii character.

! Mode 0: decrement the current cell.

Mode 1: Moves the pointer left.

Mode 2: Ends a while loop.

Mode 3: Inputs into current cell the ascii code of a character character.

Turing-completeness

Because by just changing the mode you can get a equivalent to all BF commands, it is Turing-complete.

Examples

The following M?! code prints the message “Hello World!” to the standard output:

 ????????mm?mmm?mmm????mm?mmm?mmm??m?mmm???m?mmm???m?mmm?m!!!!mmm!mm!mmm?mmm?m?mmm?m?mmm!m??mmm?mm?mmm!m!mmm!mmm!mm!mmm??mm?mm?mmm!!!mmm?m???????mmm??m???mmm?mm??mm?mm!mmm!mmm?mm!mm?m???mmm?m!!!!!!mmm?m!!!!!!!!mmm?mm??mmm?mmm?mm?mmm??mmm?

External resources

  • GitHub Implementation of the M?! programming language in Common Lisp.