grammar
Language at a glance
This is a compact guide to the grammar implemented by the current parser. Canonical output is valid Pangine syntax that parses back into the same Concept.
The forms on this page are executable today. Detailed matching, contextual traversal, answer totals, and choice behavior are still experiments rather than a permanent language specification.
Concept forms
| Form | Meaning |
|---|---|
[] | Null or no Concept |
[name] | Named Concept |
['memory'] | Named Percept reference |
(expression) | Grouping only |
[A][B] | Union by adjacency |
[A]*[B] | Explicit union merge; currently the same normal form as adjacency |
[A]/[B] | Merge with an inverted right operand |
![A] | Inversion |
[A]->[B]->[C] | One flat ordered composition; canonical output includes braces |
x2[A] | Two copies of the next union operand; x-1[A] formats as ![A] |
Percept operations
| Form | Meaning |
|---|---|
['memory'] = expression | Assign Percept state |
['memory'] += expression | Union addition |
['memory'] -= expression | Union subtraction |
['memory'] *= expression | Explicit union merge; currently the same normal form as += |
['memory'] /= expression | Inverse merge |
['memory'] ~= expression | Record one experience of an exact complete root |
['memory'] @ expression | Ask one source and bind output Percepts |
['Alice']['Bob'] @ expression | Ask several sources; parentheses are optional |
$operand | Recursively evaluate every Percept in the operand |
$['*'] | Inspect all live ordinary Concepts through a read-only computed view |
^operand | Run the current deterministic choice placeholder |
Boundaries and explicit multiplicity
Parentheses group an expression but do not create a Concept class. A directly nested unordered composition therefore normalizes into the surrounding union. Braces are the canonical boundary for an ordered composition. An unparenthesized arrow chain is flat; parentheses can explicitly retain one ordered composition as a component of another. Anx prefix writes the signed coefficient of the next union operand. x2[A] is the same Concept as[A][A], while x-1[A] formats as ![A]. The current experience implementation retains exact roots and occurrence counts.
[A][B] // union
x2[A]x3[B] // explicit member multiplicity
x2([A][B]) // two copies of both union members
{[A]->[B]->[C]} // one ordered composition
{{[A]->[B]}->[C]} // explicit nested ordered compositionExperience and questions
['Alice'] ~= {[cat]->[purrs]};
['Bob'] ~= {[cat]->[meows]};
['Alice']['Bob'] @ {[cat]->['sound']};
$['sound']Each experience records the complete input as one exact root owned by the Percept. Repeating an equal root increments its occurrence count, while an unequal root remains distinct. The root remains an ordinary Concept.
The current matcher derives compatible recursive matches from the roots and writes candidate output bindings. Ordinary Concepts are exact constraints; Percepts inside the question are the wildcard positions it fills. A flat ordered question can match an exact contiguous path inside a longer ordered root. Those recursive pieces are derived for the question.@ applies after the complete expression on its left, so['Alice']['Bob'] @ ... selects both Percepts without requiring parentheses.
The prototype keeps one whole possible answer together long enough to confirm that the complete question matches. Its current answer projection adds occurrence totals from selected exact roots and deduplicates repeated matcher routes inside one root. That is useful implemented behavior, not a settled definition of evidence.
Repeating ~= records another occurrence without requiring a user-written event Concept. The prototype currently exposes answer totals through x so ^ has an input. That reuse is provisional and is not a general truth score or definition of relevance.
In the current contextual experiment, an ordered question first matches its initial Concept exactly. Represented structure in the selected roots may connect that Concept to another ordered relationship and make its output an additional candidate. The implementation presently lets only the starting position follow context, keeps later fixed Concepts exact, and blocks a candidate from using its own relationship occurrence as its admitting route.
Those traversal boundaries and the current lack of contextual scoring are open research choices. They describe what the executable does now and do not rule out a future decision that considers the entire represented graph.
Repeating one output percept within a question pattern asks for one shared answer. For example,{['same']->['same']} requires both positions in that ordered question to bind to the same Concept, while {['left']->['right']} permits independent answers. The complete ordered question is checked together, so a nested piece cannot independently bypass a conflicting repeated binding.
Scripts
- Separate statements with semicolons.
- Use
//for line comments and/* ... */for block comments.
The console's built-in help output is the compact authority for what the current parser accepts. For the same surface introduced one command at a time, see the console walkthrough from [].