UDL

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

UDL, or Ultra-dynamically Dimensional Language, is a multi-paradigm language created in 2022 by User:Shadow Kestrel. Its data structure principles are largely inspired by Python, although its 'dimensionally rebellious' program structure is inspired by Dimensifuck and Befunge. Unlike a true n-dimensional array, UDL stores its data in 'spaces', which are effectively equivalent to dictionaries.

Structure

UDL stores all data in spaces. Spaces are formally defined as objects containing:

  • a map, of which all the names are of the same immutable type
  • a pointer, of the same type (pointer)
  • the previous value of the pointer (prev)
  • an anonymous function to be applied to the pointer (step)

The values of the map may be any object. An "object" is defined as any instance of a class, including built-in classes such as Integer and, quite importantly, Space. Spaces act as asynchronous generator functions by deferring execution.

Behaviour

At any given time, a single space is 'active'. The interpreter reads the value of the map at pointer, then executes that depending on the type. If the value is a space, the active status is transferred to the space. If the value is a string containing a single printable ASCII character, an action is taken per the table below. Otherwise, no operation is taken. Then, step is applied to pointer

character action
+ replaces self with map[prev] + map[step(pointer)] as defined by prev's addition behaviour
- replaces self with map[prev] - map[step(pointer)] as defined by prev's subtraction behaviour
d replaces self with map[prev]
S replaces self with a subspace of the active space, as determined by map[step(pointer)][see below]
i replaces self with the entirety of stdin
o pushes map[prev] to stdout
r replaces self with map[pointer] of the space at map[prev]. If map[prev] is not a space, acts as d.
w replaces map[prev] of the space at map[prev] with map[step(pointer)]. If map[prev] is not a space, noop.
w replaces pointer of the space at map[prev] with map[step(pointer)]. If map[prev] is not a space, noop.
s replaces step of the active space with map[prev].
@ apply step to pointer, then transfer the active status to the parent space. If executed in the root space, end execution.

Writing programs in UDL

UDL code