DigitDigitJump

From Esolang
Jump to navigation Jump to search

DigitDigitJump is inspired from BitBitJump.

The VM operates on a string which contains digits and non-digits characters. Addresses are expressed in base 10, and usually space-separated. For example:

   123 4567 225 ABCDEFG 114

This string contains 4 addresses: 123, 4567, 225 and 114.

These addresses are addresses of characters in the string. For example, address 11 contains the character "5" of 225.

Addresses point to numbers which are made of several digits. Addresses don't have to point to the first character of a number. The number that corresponds to an address starts either at the address, if the address points to a digit, or at the next digit, and ends at the following non-digit character. Here is table showing what number you get depending on the address:

   Address     Number
   -------     ------
   0           123
   1           23
   2           3
   3           4567
   4           4567
   5           567
   6           67
   7           7
   8           225
   9           225
   10          25
   11          5
   12          114
   13          114
   14          114
   15          114
   16          114
   17          114
   18          114
   19          114
   20          114
   21          114
   22          14
   23          4

Now, following the BitBitJump model of execution, each instruction is made of 3 addresses A B C. The character located at address A is copied to address B, then control jumps at address C.

An instruction should be able to modify its own jump address before jumping. Thus the copy operation must be completed before the jump address is read.

Even though it doesn't belong to the WordWordJump family, we'd need tables to do math. Sparse tables. For example

   Address     Value
   -------     -----  
   1XXYY0      XX + YY
   2XXYY0      XX - YY
   3XXYY0      XX * YY
   4XXYY0      XX / YY
   ...         ...

If the result of an operation needs more than 9 characters, math addresses should end with 2 zeros (1 result every 100 character).

If there are only digits and white-spaces, it's the purest thing I can think of. Tao everywhere.

See also