/Yggdrasil

A self-modifying esoteric language based around binary trees

Primary LanguagePython

Yggdrasil

A self-modifying esoteric language based around binary trees

Try it online!


Yggdrasil treats its source code and its memory as the same. The memory model used by Yggdrasil is a full binary tree, where each node is established initially by the source code. The characters "';<>+*-/^&|:=? are binary nodes, and take the next two nodes as their children. Every other character is a leaf node with no children. For example, ;<ab>+cd?e. has the following binary tree:

       ;
    /     \
   /       \
  <         >
 / \     /     \  
a   b   +       ?
       / \     /  \
      /   \   /    \
     c     d e      .

Yggdrasil technically stores each character in the tree as it's Unicode code point, and treats strings as lists of code points. Before turning the source code into a tree however, Yggdrasil makes 2 substitutions:

  • All % in the source code are replaced with NULL bytes
  • Each _ is replaced by the sequential command line arguments, with missing arguments filled with 0