Ashtol

From Esolang
Jump to navigation Jump to search

Ashtol is a programming language created by Gábor on March 11th, 2014. It uses "encrypted" directives to operate on numbers, and in the end convert those numbers into characters as output. A prototype Ashtol interpreter written in Java can be found here (run in console). Ashtol was somewhat inspired by Malbolge.

Code

Coding in Ashtol is based on the standard qwerty keyboard, or the keys in the following fashion:

1 2 3 4 5 6 7 8 9 0 - =
q w e r t y u i o p [ ]
a s d f g h j k l ; ' \
z x c v b n m , . /

The first character in an Ashtol program denotes which key the sequence of keys will begin with. Every character after the first is one of four operations: increment, decrement, multiply, divide, and they all follow this "move" rule:

      s
        - +
0 1 2 3 4 5 6 7 8 9

If you wanted to increment, you would have to type the key that is 1 down and 2 to the right of the start position (s), which, in the case of "1" being the last key pressed is the "e" key. Each new operation treats the last key pressed as the starting position for a new move. When one goes "out of bounds" of the keyboard it wraps around (e.g. incrementing after a "v" would be done with a "6").

Other rules:

  • Whitespace (and any character that does not appear on the above keyboard) is ignored, but each new line represents a character to be outputted.
  • Operations on each new line begin by manipulating the number zero.
  • All lines must begin by incrementing 0.
  • An incrementation cannot follow a decrementation and vice-versa.
  • Multiplication only occurs if a "number" is supplied when the last "-crementation" was an incrementation.
  • Division only occurs if a "number is supplied when the last "-crementation" was a decrementation.

The following program outputs an exclamation mark:

1
ez2e
  1. Moving from "1" to "e" increments 0 to 1. (Starting with 0, because this is the beginning of the first character)
  2. Moving from "e" to "z" multiplies 1 by 1.
  3. Moving from "z" to "2" decrements 1 to 0.
  4. Moving from "2" to "e" decrements 0 to -1.
  5. The final output of the program (-1) is then taken and the sign is switched to give 1, and then 32 is added to that, to give 33.
  6. 33 is converted to an exclamation mark based on the Unicode character list, and outputted.

Examples

One (simpler) way to write "Hello world!" in Ashtol:

3
tc4th4ybu,
0k.0[.-;9'x3rg3tb
7gn7in8\2efb6fnt
j5yj,yk0sc4th4yb
7gn7in8l0\v
6fb
7gn7in8j9db7o
'9p'x]s7h8p
\0[\cqd2f9p'
cqsc4svy/-]ax]s1
ez2ef2rcwv6i;-
q.0[

External resources