From Esolang
Jump to navigation Jump to search

OTOH (standing for On The Other Hand and pronounced like "Hoth" without the "H") is a simple programming language designed to combine the technical advantages of assembly with the simplicity of a Turing machine. Suggestions, comments etc. are all welcome. (OTOH was created by User:Hiant, Fading Entity on 2010-09-04)

Language Overview

OTOH uses a Tape and a swap-space of two memory cells referred to as "hands" (16 bit RAM with 1 bit id's). "hand" values are initialized and default to 0. It has several very simple operators. These are:

  ~                           The flip operator, it switches the current "hand" to the other(default "hand" is 0 at execution)
  >                           Increment memory pointer
  <                           Decrement memory pointer
  ^                           Store contents of current memory cell in current "hand" (this zeros the memory cell)
  _                           Store contents of current "hand" into current memory cell (this zeros the "hand")
  "                           Adds (current hand) to (other hand) stores the result in current hand (destructive)
  '                           Same as +, but subtracts (other hand) from (current hand)
  :                           Same as +, but multiplies
  %                           Same as +, but current hand modulo other hand
  [                           If current cell is >0, continue, else skip to matching "]"
  ]                           If current cell is 0, end loop, else skip to matching "["
  ?                           Stores current "hand" id (0 or 1) to current memory cell
  ,                           ASCII Input
  .                           ASCII Output
  !                           Clone current hand into other (non-destructive)
  #                           Switch between ASCII and Numerical mode (initialized as ASCII)

Language Standards

  • Cells may not wrap-around
  • Cells may contain any number. (signed and unsigned)
  • EOF must be 0
  • The tape cannot wrap-around, but is considered infinite to the right

Computational Class

OTOH can easily be proven Turing complete through reduction from brainfuck.

Basic Structure


Noticeably, OTOH lacks two very important BF commands, + and -. Instead, for the sake of obtuse-ification, creative use of the ? command is required. Both + and - can be simulated using this:


Where @ is either ' for - or " for +.


The ? command can also function as a logical NOT.



The : command provides a numerical equivalent to AND.


The " command provides a numerical equivalent to OR.

Hand Clear

Two multiplications (ex: (2,2):->(4,0):->(0,0))


Cell Clear

For current hand = 0


For currant hand = 1



Hello World!

Hello World, but cheating using BF reduction for now.


After optimization:


A reduction by a factor of 2!





Reverse Cat:

[  ^?~^~"?~^~"?~^~"?~^~"?~^~"
]  ^?~^~"?~^~"?~^~"?~^~"?~^~"

Not so simple.

External resources


A to-ruby compiler exists. Download it from sprunge. (dead link)