Dig

From Esolang
Jump to navigation Jump to search

Dig is a language made by User:Emerald using a 2d grid, with a 3rd direction for the language’s namesake, Dig. It is inspired by Befunge-93 and ><>, but is no way related to DigFill, a similarly sounding language.

Commands

There are 2 types of commands in Dig, Movement and Work. The main difference is that Work only can be executed underground, accessible by the dig command; meanwhile, movement is restricted overground.

Movement

Command What it does
^ Points Mole up
> Points Mole right
' Points Mole down
< Points Mole left
# Rotates Mole to left when value beside it is 0, and right when 1
$ Mole “digs” to the 3rd dimension, keeping its direction until it has moved the amount of tiles beside the $
@ Halt

Underground

Alpha-numericals and .,!? When Mole passes over, memory is overwritten with value
% Overrides current value with space when 0, and newline when 1
= Overrides current value with a single character from user
~ Overrides current value with a single integer from user
: Outputs Value in memory then, replaces it with 0
+ Overrides current value with itself plus the number besides the +
- Overrides current value with itself minus the number besides the -
* Overrides current value with itself times the number besides the *
/ Overrides current value with itself divided by the number besides the /
; When Mole passes over, the “;” is given the Moles current value

The mole is the pointer in the program, and starts from the top-left. It needs an arrow to guide its initial direction.

Memory storage

The Mole starts with a value of 0, but can be overwritten with 0-9 | a-Z

Errors

There are 3 types of errors in Dig:

Normal Errors

Error: Division by 0

Self-explanatory.

Error: Invalid Character

The character under the mole is not a command.

Error: Out of bounds

The mole is outside the range of the code (Top-left character to Bottom-right).

Interpreter Errors

These errors are specific to interpreters, so they may be different from one to another.

Dig.py
Interpreter Error: More than one number next to command

Commands such as “#”, “$”, “*”, “/”, “+”, “-”, and “%” require the a number be besides them to work but 2+ numbers is confusing, as there is no way to know which number was intended.

Interpreter Error: Tile memory full

Dig.py uses a list named tmem to store values stored in “;”, the error happens when all values are full.

User Errors

These errors are caused by user intervention in the program.

User Error: Manually halted

The user stops the program pre-maturely.

Programs

Hello World

>$H:e:l:l:o$:$%:W:o:r:$l:d:!:@
 9         1 90       6

Cat (Never stops)

>$=:'
^2  <

Truth Machine

>$~'> '
 11$^2$<
   ;#<1
    $2:
   >0^>^
    :
    @

Interpreters

This language has no implementations, being uninteresting to other people, so...
Dig.py - Coming soon | User:Emerald