Jumpmin

From Esolang
Jump to navigation Jump to search

Jumpmin is a minimalized version of Jumplang created by User:PythonshellDebugwindow. The goal of this language is to remain a Turing-complete simple translation of Jumplang.

The original commands

We start with a hefty 10 commands, so a minimalization will be welcome among avid Jumplangers.

Jumplang Command Description
+ Increment the current cell by 1
- Decrement the current cell by 1
> Increment the cell pointer
< Decrement the cell pointer
, Input an ASCII character to the current cell
. Output the current cell as an ASCII character
^ Increment the current cell by 2
v Decrement the current cell by 2
? Skips the next command if the current cell is 0
! Performs an absolute jump to the 0-based Nth character in the source, where N is the cell pointer + 1th cell (jumping negative or out of bounds halts the program)

All others are nops.

Minimalization

Our 10 instructions include I/O (, and .), which is unnecessary for Turing-completeness, so it can be removed, leaving 8 instructions. The ^ and v can now be used for all your incrementing and decrementing needs (their only real advantages over + and - were I/O-related—they were good for printing characters with odd ASCII values and for zeroing characters with odd ASCII values—but since I/O is now removed, they have no advantage over the increment-by-2 and decrement-by-2 commands), so + and - can be removed. We now have 6 instructions:

Intermediate Command Description
> Increment the cell pointer
< Decrement the cell pointer
^ Increment the current cell by 2
v Decrement the current cell by 2
? Skips the next command if the current cell is 0
! Performs an absolute jump to the 0-based Nth character in the source, where N is the cell pointer + 1th cell (jumping negative or out of bounds halts the program)

?! can be merged into one instruction, , which is a conditional jump (the current cell is used for the condition, and the cell after that is used for the jump address), leaving us with a 5-command Turing-complete Jumplang minimalization.

Minimized commands

Minimalized Command Description
> Increment the cell pointer
< Decrement the cell pointer
^ Increment the current cell by 2
v Decrement the current cell by 2
If the current cell is 0, performs an absolute jump to the 0-based Nth character in the source, where N is the cell pointer + 1th cell (jumping negative or out of bounds halts the program)

Simple translation to Jumplang

Jumpmin Jumplang
> >
< <
^ ^
v v
?!

As you can see, not much has changed (except, of course, the 4 completely removed commands).

Translator to Jumplang

def jumpmin_to_jumplang(jm):
  jl = ""
  for c in jm:
    if c == "‽": jl += "?!"
    else: jl += c
  return jl

Further development

If you have any ideas of how to further minimize the language while keeping it TC, you can put them on the talk page.