uxntal


uxntal logo: a beet, wired to the box it is on top of, which is labelled with a typographically stylized

uxntal is the de facto standard programming language for the uxn virtual machine. Its design uses a shallow embedding of the underlying virtual machine's model, with a majority of program text often being named use of virtual machine instructions.

Designed as a thin language on a base of named instruction, its ahead-of-time compiled implementation is in the practical class of macro assembler.

Its practice often involves use of the varvara computer system extension to the virtual machine, which includes standard interfaces for external resource interaction (e.g. screen drawing, system time).

syntax

uxntal syntax is described here using the rules of a generative grammar, encoding a set of program texts that:

program

The generative grammar is given in a Bachus-Naur Form with two extensions. First, as shorthand, take to be any amount of whitespace separation, <hex1> to be any hexadecimal character 0f, with <hexn> a string of n hexadecimal characters (e.g., <hex2> encoding 00ff a byte). Second, uxntal naming forms are defined as being not something, which resists BNF expression: instead, take as given:
  1. a <STRING> is anything but its closing
  2. a <COMMENT> is anything but its closing ␣)
  3. an <ID> is anything but the finite sets <opcode> and reserved hexadecimal strings <hex1> <hex2> <hex3> <hex4>.
<program> = concatenating
| <program><program>
operation
| <opcode>
assembler control
| $<ID>
| $<hex1>
| $<hex2>
| $<hex3>
| $<hex4>
| |<ID>
| |<hex1>
| |<hex2>
| |<hex3>
| |<hex4>
literals
| <ID>
| <hex2>
| "<STRING>
| #<hex2>
| #<hex4>
referencing
| ,<refer>
| _<refer>
| .<refer>
| ~<refer>
| ;<refer>
| =<refer>
defining IDs
| %<ID>␣{␣<program>␣}
| @<ID><program>
| &<ID><program>
bracketing
| [␣<program>␣]
| (␣<COMMENT>␣)
a reference can be to a concrete identifier, or to an anonymous label denoted by curly bracketing (a lambda):
<refer> = <ID>
| {␣<program>␣}

opcode

<core-opcode> = arithmetic
| INC | ADD | SUB
| MUL | DIV | SFT
| AND | ORA | EOR
test conditionals
| EQU | NEQ
| GTH | LTH
stack combinators
| POP | NIP
| DUP | OVR
| ROT | STH
memory & I/O
| LIT | DEI | DEO
| STZ | STR | STA
| LDZ | LDR | LDA
jumps & control flow
| JMP | JCN | JSR
the <core-opcodes> are extended with four additional forms, and by mode suffixes:
<opcode> = BRK
| JCI | JMI | JSI
| <core-opcode>
| <core-opcode>2
| <core-opcode>k
| <core-opcode>r
| <core-opcode>2k
| <core-opcode>2r
| <core-opcode>kr
| <core-opcode>2kr

versioning schema

uxntal itself does not include a mechanism version reporting. varvara includes a standard memory address for reporting a string of metadata with a conventional structure.

memory expansion

the uxntal memory model uses, as its base, 16b pointers for 64KiB of total addressable memory.

further

references

uxntal

Information gathered here through correspondence in #uxn on IRC and Discord. https://git.sr.ht/~rabbits/drifblim/tree/main/item/examples/acid.tal https://git.sr.ht/~rabbits/drifblim/tree/main/item/tests.sh

uxn

Bauchus-Naur Form https://wiki.xxiivv.com/site/metadata.html https://git.sr.ht/~rabbits/oquonie/tree/3abf70e69b53cf45b7420b84bcf0f2d9d6fd83ed/item/src/oquonie.tal#L896 https://git.sr.ht/~rabbits/uxn-utils/blob/a4b1f38de9121ffb5ab3e3826602d14b933970ce/gui/meta/meta.tal