☯️ Glyphic Language — BNF Grammar Specification (v1.0) Formal Grammar for the Glyphic OS Interpreter This grammar defines the canonical structure of a valid glyph sequence. It is strict, deterministic, and reversible.
Top‑Level Grammar Code ::= A valid sequence must follow this order. All blocks are optional except that at least one of:
must be present.Actor Block Code ::= | ε ::= Constraints: Only one actor allowed. If present, it must appear first.
Action Block Code ::= | ε ::= Constraints: Only one action allowed. Must appear after actor, if actor exists.
Object Block Code ::= | ε ::= Constraints: Only one primary object allowed. Must appear after action, if action exists.
Modifier Block Code ::= | ε ::= | ::= Constraints: Zero or more modifiers allowed. Must appear after object, if object exists. Modifiers cannot appear after context.
Context Block Code ::=
Context Subtypes Place Context Code ::= | ε ::= | ::= Time Context Code ::= | ε ::= | ::= Emotional Context Code ::= | ε ::= | ::= Sensory Context Code ::= | ε ::= | ::= Social Context Code ::= | ε ::= | ::=
Glyph Terminals These terminals correspond directly to dictionary roles. Code ::= any glyph with role "actor" ::= any glyph with role "action" ::= any glyph with role "object" ::= any glyph with role "modifier" ::= any glyph in category "context_place." ::= any glyph in category "context_time." ::= any glyph in category "context_emotion." ::= any glyph in category "context_sensory." ::= any glyph in category "context_social.*" These terminals are not literal characters — they are semantic classes defined by the dictionary.
Role Precedence (Disambiguation Rule) If a glyph has multiple roles (rare but allowed), precedence is: Code actor > action > object > modifier > context This ensures deterministic parsing.
Validity Constraints (Non‑BNF but Required) These constraints are enforced by the interpreter:
Example Valid Sequences Actor + Action + Object Code Object + Modifier + Context Code Action + Context Code Full Scene Code
Example Invalid Sequences ❌ Context before object Code ❌ Multiple actions Code ❌ Social context before sensory context Code ❌ No core role Code
Each context subtype is optional, but must appear in this order if present.
10.1 Required Core Role At least one of: actor action object must be present.
10.2 Context Must Be Last No context glyph may appear before: actor action object modifier
10.3 Single Actor / Action / Object Only one of each is allowed.
10.4 Context Ordering Context subtypes must appear in this order: Code place → time → emotion → sensory → social
10.5 Reversibility All valid sequences must satisfy: Code encode(decode(sequence)) == sequence This is guaranteed by the grammar.