rep_str2bin_struct
No arguments
Description:
Create a binary tree image from a control string as interpreted by BinArbor coding language
(Also made by Reptorian.).
Control characters:
^ = Move to parent node.
< = Create left child if needed, then move to it.
> = Create right child if needed, then move to it.
: = Create missing left/right children without moving.
~ = Move to sibling branch. Creates sibling if missing.
* = Move to current subtree root.*
+ = Move upward along same branch direction.
- = Move downward along same branch direction.
*A subtree root is the node where the current local branch context began.
Random leaf navigation:
( = Move to random node missing a left child.
) = Move to random node missing a right child.
| = Move to random node missing either child.
Expressions and local branching:
{...} = Evaluate expression and store result in node.
[...] = Evaluate inside local subtree context.
Variables:
name = Assign current node to variable name.*
@name = Move to variable node.
Cannot begin with _ or a number!
Repeat loops:
N{...} = Repeat enclosed block N times.
N... = Repeat next section until ''.
Expression Functions:
dir() = Return current branch direction.
Error at subtree root.
root() = Return value of current subtree root.
Error at subtree root.
L() = Return value of left child.
Error if no left child exists.
R() = Return value of right child.
Error if no right child exists.
For this implementation, all G'MIC JIT expressions are supported.
Ignored characters:
space, newline, /
Output Binary tree node layout:
0 = parent index*
1 = left child index
2 = right child index
3 = depth level
4+ = stored values (if vector_size > 0)
*For the very first pixel at the top, parent index is actually maximum depth level
Example:
<>~:
Produces:
o
/
o
/
o o
/
o o
Author: Reptorian.