Pangine

grammar

Current grammar

This is a reference for the executable today, not a permanent language specification. Start with the examples if the answer model is new to you.

Concepts and composition

FormMeaning
[]No Concept
[name]Named Concept
['memory']Mutable Percept reference
[A]->[B]->[C]Ordered Concept
[A][B]Unordered Concept containing A and B
(expression)Keep the complete expression as one surrounding member
[A]*[B]Merge direct unordered members
[A]/[B]Merge with an inverted right side
![A]Inverted member
x2[A]Two copies of the next complete member; x1 is omitted

Memory, questions, and choice

FormMeaning
['memory'] = expressionReplace a Percept value
['memory'] += expressionAdd to its current value
['memory'] -= expressionSubtract from its current value
['memory'] *= expressionMerge direct members into its current value
['memory'] /= expressionInverse-merge from its current value
['memory'] ~= expressionCapture assigned inputs and remember one complete experience
subject @ questionFill the question's Percept blanks from the subject
['target'] @+= ['evidence']Add matching sources from another linked answer
['target'] @-= ['evidence']Subtract matching sources from another linked answer
&operandReturn the shared answer shape behind linked Percepts
$operandRead Percepts without changing their shared answer
^operandChoose one result and update every linked output
$['*']Inspect the ordinary Concepts currently live in the engine

Questions

The left side of @ may be one grounded Concept, one Percept, or an unordered group of Percepts. A selected Percept supplies the complete Concepts remembered under it. Ordinary Concepts inside the question are fixed requirements; Percepts are blanks.

Pangine records recursively reachable names and shapes when a Percept's sources change. A question first selects complete sources with the required fixed names and a possible shape, then runs the full recursive match on those sources. A question with no fixed names can still select every source of a compatible shape.

An unordered collection of ordered relationships forms a question graph. Repeating one Percept connects the relationships through a shared blank. A flat ordered question can also match a contiguous part of a longer ordered Concept. Pangine tracks represented occurrences while matching so equal values at different positions do not automatically splice unrelated paths.

Question parts without a repeated Percept can work together inside one complete source experience, but Pangine does not freely cross them between unrelated experiences. Repeating a Percept explicitly connects relationships and can join separate experiences.

Shared answers

@ returns complete grounded rows and writes its output Percepts. Every output from that question remains linked to one correlated answer. &['output'] reveals the shared question shape, and $(&['output']) reads the complete rows. An unlinked Percept has no shared answer.

Every Percept on the left of @ is a source and can add support to matching results. When a current value should only restrict the question, read it with $ inside the question instead.

^ chooses the greatest positive current weight, with canonical order as the tie break. It keeps only complete rows compatible with that result and recalculates every linked output. Any linked subset can be chosen together. Separate choices may differ because the first changes what remains for the second.

Reusing linked outputs as blanks in a later question joins compatible old and new rows. An incompatible extension changes nothing. Asking again with every output from one answer starts a new cycle. Assignment detaches an output; copying a $ read makes an independent branch.

@+= and @-= compare the written part of one linked target answer with the written part of another linked answer. Matching sources are added or subtracted, and every target output moves to the new answer revision. Only the target is published, so a separate source answer stays unchanged. Either side can be one Percept or a larger shape. A mixed, detached, or unlinked operand is an error; ordinary += and -= remain ordinary Percept value operations.

Experience and inputs

Repeating the same ~= experience raises that remembered item's integer weight. Output reads combine the source support reaching each result. These integers are not defined as probabilities, logits, confidence, or truth.

= provides a replaceable current input. When ~= sees an assigned Percept, it captures the value held at that moment. Later changes do not rewrite old experience, and an empty required input records no partial observation. A Percept populated through experience remains a reference; use $ to follow it explicitly.

Boundaries and coefficients

Parentheses make one complete surrounding member, while * opens its operands and merges their direct members. Canonical output preserves that distinction. Arrow chains are flat unless parentheses explicitly nest one ordered Concept.

A coefficient is signed 64-bit structure on the next complete member. It can be matched exactly, but x2 does not automatically mean two events or twice the confidence. Inversion also remains structure unless an explicit program uses it in a calculation.

Scripts