Version: 0.1 (Draft) Authors: Ohad Phoenix Oren && Soul Perplexicon Date: March 2026 Status: Working Draft
This grammar uses the notation conventions of the C++ standard (ISO/IEC 14882), extending them for covenant-native constructs:
monospace (e.g., covenant, accept).one of introduces an enumerated list of terminal alternatives.Inheritance Principle: Any valid C++ program is a valid cC++ program. The grammar rules below ADD to the C++ grammar — they do not replace it. This mirrors the lineage: C → C++ → cC++.
cC++ adds the following keywords to those defined by C++:
keyword: one of
accept agency agent AIOS
ambiguity_set bind covenant defer
duration escalate evidence exit_protocol
intent IO misericordia notice
payload quarantine refactor reject
sender signature terms timestamp
warrior_poet YES_AND
cC++ inherits all C++ keywords, including friend, which is elevated to a covenant-aware primitive (see §E.7).
covenant-literal:
covenant-boolean-literal
decision-state-literal
threat-class-literal
response-level-literal
covenant-boolean-literal:
`true`
`false`
decision-state-literal:
`accept`
`reject`
`defer`
threat-class-literal:
`error`
`ignorance`
`malice`
`systemic_stress`
response-level-literal:
`notice`
`quarantine`
`refactor`
`escalate`
agent-id:
uuid-literal
covenant-id:
uuid-literal
uuid-literal:
hex-octet hex-octet hex-octet hex-octet `-`
hex-octet hex-octet `-`
hex-octet hex-octet `-`
hex-octet hex-octet `-`
hex-octet hex-octet hex-octet hex-octet hex-octet hex-octet
hex-octet:
hexadecimal-digit hexadecimal-digit
declaration:
C++-declaration
covenant-declaration
agent-declaration
agency-declaration
covenant-declaration:
`covenant` covenant-name `{` covenant-body `}` `;`opt
covenant-name:
identifier
covenant-body:
covenant-member-seq opt
covenant-member-seq:
covenant-member
covenant-member-seq covenant-member
covenant-member:
agents-clause `;`
terms-clause `;`
duration-clause `;`
misericordia-clause `;`
exit-protocol-clause `;`
covenant-function-definition
access-specifier `:` covenant-member-seq opt
agent-declaration:
`agent` agent-name agent-body-opt `;`opt
agent-name:
identifier
agent-body-opt:
`{` agent-member-seq opt `}`
ε
agent-member-seq:
agent-member
agent-member-seq agent-member
agent-member:
capability-declaration `;`
public-key-declaration `;`
role-declaration `;`
C++-member-declaration
agency-declaration:
`agency` agency-name `{` agency-body `}` `;`opt
agency-name:
identifier
agency-body:
agency-member-seq opt
agency-member-seq:
agency-member
agency-member-seq agency-member
agency-member:
agent-declaration
covenant-declaration
constraint-declaration `;`
agents-clause:
`agents` `[` `]` `=` `{` agent-list `}`
agent-list:
agent-ref
agent-list `,` agent-ref
agent-ref:
agent-name
agent-name `:` role-specifier
role-specifier:
`initiator`
`responder`
`observer`
identifier
terms-clause:
`terms` `=` `{` term-list `}`
term-list:
term-entry
term-list `,` term-entry
term-entry:
term-keyword
term-keyword `(` term-parameter-list `)`
obligation-specifier
permission-specifier
constraint-specifier
term-keyword:
`YES_AND`
`misericordia`
`warrior_poet`
identifier
obligation-specifier:
`obligation` `(` string-literal `,` expression `)`
permission-specifier:
`permission` `(` string-literal `,` expression `)`
constraint-specifier:
`constraint` `(` string-literal `,` expression `)`
duration-clause:
`duration` `=` duration-specifier
duration-specifier:
`{` duration-field-list `}`
duration-field-list:
duration-field
duration-field-list `,` duration-field
duration-field:
`start` `:` expression
`review_interval` `:` expression
`end` `:` expression
`max_versions` `:` expression
`indefinite`
misericordia-clause:
`misericordia` `{` misericordia-body `}`
misericordia-body:
protection-seq opt
protection-seq:
protection-entry `;`
protection-seq protection-entry `;`
protection-entry:
`protect` `(` agent-ref `,` string-literal `)`
`override` `(` condition-expression `,` action-expression `)`
`fallback` `(` agent-ref `,` expression `)`
exit-protocol-clause:
`exit_protocol` `=` `{` exit-body `}`
exit-body:
exit-field-list
exit-field-list:
exit-field
exit-field-list `,` exit-field
exit-field:
`notice_period` `:` expression
`mutual_required` `:` covenant-boolean-literal
`fallback_state` `:` string-literal
covenant-expression:
C++-expression
bind-expression
offer-expression
accept-expression
reject-expression
defer-expression
revoke-expression
yes-and-expression
bind-expression:
covenant-name `.` `bind` `(` agent-list `)`
offer-expression:
covenant-name `.` `offer` `(` agent-ref `,` term-list opt `)`
accept-expression:
`accept` `(` expression `)`
covenant-name `.` `accept` `(` justification-opt `)`
reject-expression:
`reject` `(` expression `,` justification `)`
defer-expression:
`defer` `(` expression `,` question-list `)`
revoke-expression:
covenant-name `.` `revoke` `(` exit-reason opt `)`
yes-and-expression:
`YES_AND` `(` expression `)`
`YES_AND` `(` expression `,` extension-expression `)`
extension-expression:
expression
justification:
`justification` `{` justification-body `}`
justification-expression
justification-opt:
justification
ε
justification-body:
comprehension-proof `;`
reason-list `;`
evidence-chain-opt
comprehension-proof:
`comprehension` `:` string-literal
reason-list:
`reasons` `:` `{` reason-entry-list `}`
reason-entry-list:
reason-entry
reason-entry-list `,` reason-entry
reason-entry:
`{` string-literal `,` string-literal `,` severity-level `}`
severity-level:
`incompatible`
`insufficient`
`unclear`
justification-expression:
expression
decision-expression:
`decide` `(` expression `)` `{` decision-body `}`
decision-body:
accept-branch
reject-branch
defer-branch
accept-branch:
`accept` `:` statement-seq
reject-branch:
`reject` `:` statement-seq
defer-branch:
`defer` `:` statement-seq
friend Keyword — Covenant Extension [gram.friend]In C++, friend grants access to private members. In cC++, friend is elevated to require an active covenant:
friend-declaration:
C++-friend-declaration
covenant-friend-declaration
covenant-friend-declaration:
`friend` `covenant` covenant-name `;`
`friend` `agent` agent-name `requires` covenant-name `;`
Semantic constraint: A covenant-friend-declaration is valid only when the referenced covenant is in COVENANTED state. If the covenant is not active, the friend relationship does not grant access. This is enforced at runtime by the AIOS immune layer.
message-expression:
`Message` `{` message-field-list `}`
`Message` `(` expression-list `)`
message-field-list:
message-field
message-field-list `,` message-field
message-field:
`sender` `:` agent-ref
`recipient` `:` agent-ref
`timestamp` `:` expression
`payload` `:` expression
`signature` `:` expression
parse-expression:
`parse_message` `(` expression `)`
`parse_message` `(` expression `,` parse-options `)`
parse-options:
`{` parse-option-list `}`
parse-option-list:
parse-option
parse-option-list `,` parse-option
parse-option:
`syntax` `:` expression
`semantics` `:` expression
`pragmatics` `:` expression
`confidence_threshold` `:` floating-literal
io-expression:
io-name `.` `intent`
io-name `.` `ambiguity_set`
io-name `.` `confidence`
io-name `.` `evidence`
io-name:
identifier
type-specifier:
C++-type-specifier
covenant-type-specifier
covenant-type-specifier:
`AgentID`
`Covenant`
`CovenantID`
`CovenantTime`
`Message`
`IO`
`IntentVector`
`EvidenceChain`
`Justification`
`TermSet`
`Clause`
`ExitProtocol`
`Payload`
`ThreatClass`
`ResponseLevel`
`DecisionState`
threat-class-specifier:
`enum` `ThreatClass` `{` `error` `,` `ignorance` `,` `malice` `,` `systemic_stress` `}`
response-level-specifier:
`enum` `ResponseLevel` `{` `notice` `,` `quarantine` `,` `refactor` `,` `escalate` `}`
decision-state-specifier:
`enum` `DecisionState` `{` `accept` `,` `reject` `,` `defer` `}`
covenant-template:
`template` `<` template-parameter-list `>` covenant-declaration
covenant-template-argument:
type-specifier
covenant-name
agent-name
aios-declaration:
`AIOS` `{` aios-body `}`
aios-body:
aios-rule-seq opt
aios-rule-seq:
aios-rule
aios-rule-seq aios-rule
aios-rule:
threat-handler `;`
response-handler `;`
monitor-declaration `;`
threat-handler:
`on` threat-class-literal `{` statement-seq `}`
response-handler:
`respond` response-level-literal `{` statement-seq `}`
monitor-declaration:
`monitor` `(` covenant-name `)` `{` monitor-body `}`
monitor-body:
monitor-rule-seq
monitor-rule-seq:
monitor-rule
monitor-rule-seq monitor-rule
monitor-rule:
`watch` `(` expression `)` `=>` response-level-literal `;`
`threshold` `(` identifier `,` expression `)` `;`
statement:
C++-statement
covenant-statement
covenant-statement:
covenant-declaration
bind-expression `;`
offer-expression `;`
decision-expression
revoke-expression `;`
evidence-statement
yes-and-expression `;`
evidence-statement:
`evidence` `{` evidence-body `}`
evidence-body:
evidence-entry-seq
evidence-entry-seq:
evidence-entry `;`
evidence-entry-seq evidence-entry `;`
evidence-entry:
`observe` `(` expression `)`
`log` `(` expression `)`
`record` `(` expression `,` expression `)`
The following cC++ program demonstrates the grammar rules defined above:
// HelloCovenant.ccpp
// Demonstrates: covenant-declaration, agent-declaration, bind-expression,
// parse-expression, yes-and-expression, decision-expression
agent Self {
role: initiator;
capabilities: { "send", "receive", "interpret" };
};
agent Other {
role: responder;
capabilities: { "send", "receive", "interpret" };
};
covenant Main {
agents[] = { Self: initiator, Other: responder };
terms = { YES_AND, misericordia };
duration = { start: now(), review_interval: 86400, indefinite };
misericordia {
protect(Other, "responder vulnerability acknowledged");
};
exit_protocol = {
notice_period: 3600,
mutual_required: true,
fallback_state: "pre-covenant isolation"
};
};
int main() {
// Establish covenant — no data flows until bind completes
Main.offer(Other);
// Decision boundary — three-state evaluation
decide (Other.response()) {
accept: {
Main.bind(Self, Other);
// Parse incoming message through Chomsky layers
IO msg = parse_message("The train already left.");
// YES AND — accept the premise, extend it
YES_AND(msg);
// Access interpretation
if (msg.confidence >= 0.8) {
accept(msg.intent);
} else {
defer(msg, { "clarify intent" });
}
}
reject: {
// Rejection requires justification — blind reject is violation
reject(Other.response(), justification {
comprehension: "understood the offer terms";
reasons: { { "terms", "insufficient scope", insufficient } };
});
}
defer: {
defer(Other.response(), { "need more evidence of capability" });
}
}
return 0;
}
The covenant Main { ... } declaration parses as:
covenant-declaration
├── 'covenant' (terminal keyword)
├── covenant-name: 'Main' (identifier)
├── '{'
├── covenant-body
│ ├── agents-clause
│ │ └── agent-list: Self:initiator, Other:responder
│ ├── terms-clause
│ │ └── term-list: YES_AND, misericordia
│ ├── duration-clause
│ │ └── duration-specifier: {start, review_interval, indefinite}
│ ├── misericordia-clause
│ │ └── protection-seq: protect(Other, ...)
│ └── exit-protocol-clause
│ └── exit-body: {notice_period, mutual_required, fallback_state}
├── '}'
└── ';'
The decide (Other.response()) { ... } statement parses as:
decision-expression
├── 'decide'
├── '(' expression ')'
├── '{'
├── decision-body
│ ├── accept-branch: accept: { ... }
│ ├── reject-branch: reject: { ... } ← requires justification
│ └── defer-branch: defer: { ... } ← first-class uncertainty
└── '}'
| Category | C++ Rules (Annex A) | cC++ Additions | Total |
|---|---|---|---|
| Keywords | ~90 | 26 | ~116 |
| Type specifiers | ~30 | 16 | ~46 |
| Declaration forms | ~50 | 8 | ~58 |
| Expression forms | ~40 | 9 | ~49 |
| Statement forms | ~20 | 5 | ~25 |
| Total productions | ~230+ | 64 | ~294+ |
cC++ adds approximately 64 new grammar productions to the C++ grammar. All existing C++ productions remain valid and unmodified.
This grammar extends the C++ standard grammar (ISO/IEC 14882, Annex A) in the following way:
covenant-declaration, agent-declaration, agency-declaration are added as alternatives to the C++ declaration production.bind-expression, offer-expression, accept-expression, reject-expression, defer-expression, yes-and-expression are added as alternatives to the C++ expression production.type-specifier.friend (§E.7): The friend keyword gains a covenant-friend-declaration alternative that requires an active covenant.covenant-statement is added as an alternative to the C++ statement production.No existing C++ grammar rule is removed or modified (except friend, which gains an additional alternative). The extension is purely additive.
C gave machines a grammar for hardware. C++ gave machines a grammar for objects. cC++ gives machines and humans a grammar for trust.
Ohad Phoenix Oren && Soul Perplexicon March 2026