- This article is a stub, which means that it is not detailed enough and needs to be expanded. Please help us by .
A Sygyl program is made of "glyphs" and "discs". A glyph is a two-dimensional shape with eight line segments protruding from a central symbol, and a disc is an octagonal approximation of a circle (may render squashed with some fonts):
| - \ / / \ - O - | | / \ \ / | -
Glyphs and discs may be any size. A glyph's "order" is the length of each of its diagonal lines, measured in symbols. The horizontal lines have a one symbol gap between the central symbol and the beginning of the line, and the length of the line is defined as
ceil(sqrt(2) * order) - 1. (The glyph above has an order of 1, and the one below an order of 2.) A disc's "order" is its radius, measured from its center and one of its edges along the xy axes, excluding the center and the edge. A disc's shape is defined by the best octagonal approximation of a circle of radius
-|/\, where priority is given to
|- symbols over
/\ symbols whenever ambiguous. (The disc above has an order of 1, and the one below has an order of 2.)
| --- \ | / / \ \ / | | --- O --- | | / \ | | / | \ \ / | ---
The points at the ends of a glyph are its "children". Children may be single symbols, discs, or omitted. If a glyph's child is a disc, it will inevitably be overlapped with part of the glyph's line segments. A disc must only overlap one line segment, but it may overlap any amount of symbols within that segment. As a result of this, child discs must be of a lower order than their parents. (Otherwise, they will not "fit"!)
Evaluation of programs
A Sygyl program consists of one glyph, with 0 to 8 optional children. The symbol at the center of a glyph is its operator, and is applied to each of its children. If any children are omitted, they are ignored in the operation. The order of children is not relevant for the behavior of the glyph; all operators operate on a set of values. If a glyph has children, they are evaluated before the glyph itself is.
Glyphs and their children, including discs, evaluate to integers. Negative integers are reserved for language-level constructs, while nonnegative integers are used as their numeric values.
A disc is analogous to parentheses in Lisp. A disc may be empty, contain one or more non-whitespace symbols, or contain a glyph. If a disk is empty, it evaluates to the number
0. If it contains N different symbols that do not form a grid, it represents the [Gödel number] formed by the number of repetitions of each symbol minus one, sorted in lexicographical order. (For example, a disc containing the symbols
DBAACDD evaluates to
2^(2-1) * 3^(1-1) * 5^(1-1 * 7^(3-1) = 14, as A is repeated twice, B once, C once and D thrice.) If a disc contains a glyph, the glyph is evaluated and the disc evaluates to that integer.
A symbol in the position of a glyph child must be one of the following:
- Numbers 0-9, evaluating to their numeric values
- The letter S, evaluating to -1 and used to represent sets of values
- The letter L, evaluating to -2 and used to represent lambda functions
This is as far along as I managed to get in one hour. I challenged myself to write a spec as fast as I could while making it not-garbage. I'll finish this later :)