Dig

From Esolang
Jump to navigation Jump to search
Dig
Paradigm(s) Imperative paradigm
Designed by User:Emerald
Appeared in 2020
Memory system Cell-based
Dimensions Two dimensional
Computational class Unknown computational class
Major implementations Python interpreter by User:Bangyen
Influenced by Fish, Befunge
File extension(s) .dig, .dg


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. When it’s neither of those, keep straight.
$ 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

Interpreters when faced with more than one value next to “#”, “$”, or “%” should prefer use up, right, down, left.

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: 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:!:@
 8        8  0     8

Cat (Never stops)

>$=:'
^2  <

Truth Machine

'   @
    :
    $1
>$~;#
 2  >$+:'
    ^21 <

Interpreters

A Python interpreter by User:Bangyen.

A Lua interpreter by User:DeybisMelendez.