483bc68a94
Enable evolution by default for source-backed workspaces. Add stable conformance ownership, semantic-major review, candidate typechecking, and durable fenced cutover with explicit migrations and forward recovery. Independently supervise package runtimes so unchanged resource owners keep their processes and connections across cutover. Add scoped invocation authority, resource sessions, and typed callback rebinding. Wire opaque object references through generated bindings and RPCs. Add canonical relationship sets, keyed maps, and ordered lists with scoped transactional mutations, revision checks, and inverse consistency. Support planned cascade deletion, protection, tombstones, and lifecycle foundations. Add journaled structural edits, package/function/migration scaffolding, managed repository creation, and resumable bottom-up dependency pin publication. Document lifetime boundaries, revision pinning, prototype compatibility policy, commands, and deferred work. Validate with 210 tests, user-systemd process/connection continuity, generated-package TypeScript checks, and Nix host/protocol checks. TTL handoff, physical reclamation, general multi-step migrations, and root-systemd migration isolation acceptance remain deferred.
449 lines
8.5 KiB
ANTLR
449 lines
8.5 KiB
ANTLR
grammar QuixosCapability;
|
|
|
|
document
|
|
: workspaceDecl EOF
|
|
| interfaceResourceDecl EOF
|
|
| packageResourceDecl EOF
|
|
| fragmentDecl EOF
|
|
;
|
|
|
|
fragmentDecl
|
|
: FRAGMENT LBRACE workspaceItem* RBRACE
|
|
;
|
|
|
|
sourceImportDecl
|
|
: IMPORT stringLiteral SEMI
|
|
;
|
|
|
|
workspaceDecl
|
|
: WORKSPACE identifier ID stringLiteral REVISION stringLiteral COMMIT stringLiteral
|
|
LBRACE workspaceItem* RBRACE
|
|
;
|
|
|
|
workspaceItem
|
|
: sourceImportDecl
|
|
| atomDecl
|
|
| resourceImportDecl
|
|
| sharedAttachmentDecl
|
|
| conformanceDecl
|
|
| constructorBindingDecl
|
|
;
|
|
|
|
resourceImportDecl
|
|
: IMPORT INTERFACE identifier SEMI
|
|
| IMPORT PACKAGE identifier SEMI
|
|
;
|
|
|
|
externalAtomDecl
|
|
: EXTERNAL ATOM identifier ID stringLiteral SEMI
|
|
;
|
|
|
|
externalInterfaceDecl
|
|
: EXTERNAL INTERFACE identifier REVISION stringLiteral SEMI
|
|
;
|
|
|
|
resourcePreamble
|
|
: resourceImportDecl
|
|
| externalAtomDecl
|
|
| externalInterfaceDecl
|
|
;
|
|
|
|
atomDecl
|
|
: ATOM identifier ID stringLiteral (DOC stringLiteral)? SEMI
|
|
;
|
|
|
|
interfaceResourceDecl
|
|
: resourcePreamble* INTERFACE identifier ID stringLiteral REVISION stringLiteral
|
|
LBRACE interfaceMember* RBRACE
|
|
;
|
|
|
|
interfaceMember
|
|
: valueMember
|
|
| relationshipMember
|
|
| operationMember
|
|
;
|
|
|
|
operationMember
|
|
: OPERATION identifier ID stringLiteral COLON valueType ARROW valueType
|
|
LBRACE CALL ID stringLiteral SEMI RBRACE
|
|
;
|
|
|
|
valueMember
|
|
: VALUE identifier ID stringLiteral COLON valueType
|
|
LBRACE valueMemberOperation* RBRACE
|
|
;
|
|
|
|
valueMemberOperation
|
|
: GET ID stringLiteral SEMI
|
|
| SET ID stringLiteral SEMI
|
|
| WATCH START ID stringLiteral STOP ID stringLiteral SEMI
|
|
;
|
|
|
|
relationshipMember
|
|
: RELATION identifier ID stringLiteral COLON cardinality targetConstraint ORDERED?
|
|
LBRACE relationshipOperation* RBRACE
|
|
;
|
|
|
|
relationshipOperation
|
|
: RESOLVE ID stringLiteral SEMI
|
|
| CONNECT ID stringLiteral SEMI
|
|
| DISCONNECT ID stringLiteral SEMI
|
|
| WATCH START ID stringLiteral STOP ID stringLiteral SEMI
|
|
;
|
|
|
|
targetConstraint
|
|
: ATOM identifier
|
|
| INTERFACE identifier
|
|
;
|
|
|
|
packageResourceDecl
|
|
: resourcePreamble* PACKAGE identifier ID stringLiteral REVISION stringLiteral
|
|
(SEMANTIC_MAJOR INTEGER)?
|
|
LBRACE packageExport* RBRACE
|
|
;
|
|
|
|
packageExport
|
|
: packageOperationExport
|
|
| packageFunctionExport
|
|
| packageConstructorExport
|
|
;
|
|
|
|
packageOperationExport
|
|
: OPERATION identifier ID stringLiteral COLON valueType ARROW valueType
|
|
MODE operationMode eventClause? RECEIVER receiverRequirement dependencyBlock? SEMI
|
|
;
|
|
|
|
packageFunctionExport
|
|
: FUNCTION identifier ID stringLiteral COLON valueType ARROW valueType
|
|
dependencyBlock? SEMI
|
|
;
|
|
|
|
packageConstructorExport
|
|
: CONSTRUCTOR identifier ID stringLiteral CONSTRUCTS identifier COLON valueType
|
|
dependencyBlock? SEMI
|
|
;
|
|
|
|
eventClause
|
|
: EMITS valueType
|
|
;
|
|
|
|
operationMode
|
|
: CALL
|
|
| WATCH_START
|
|
| WATCH_STOP
|
|
| SUBSCRIBE
|
|
| UNSUBSCRIBE
|
|
;
|
|
|
|
receiverRequirement
|
|
: ANY
|
|
| ATOM identifier
|
|
| INTERFACES LBRACK identifierList? RBRACK
|
|
;
|
|
|
|
identifierList
|
|
: identifier (COMMA identifier)*
|
|
;
|
|
|
|
dependencyBlock
|
|
: REQUIRES LBRACE dependencyPort* RBRACE
|
|
;
|
|
|
|
dependencyPort
|
|
: STATE identifier ID stringLiteral COLON valueType primitiveList SEMI
|
|
| EDGE identifier ID stringLiteral COLON cardinality targetConstraint primitiveList SEMI
|
|
| INTERFACE identifier ID stringLiteral COLON identifier SEMI
|
|
| CONSTRUCTOR identifier ID stringLiteral COLON identifier (INPUT valueType)? SEMI
|
|
;
|
|
|
|
primitiveList
|
|
: LBRACK primitive (COMMA primitive)* RBRACK
|
|
;
|
|
|
|
primitive
|
|
: READ
|
|
| WRITE
|
|
| RESOLVE
|
|
| CONNECT
|
|
| DISCONNECT
|
|
| WATCH_START
|
|
| WATCH_STOP
|
|
;
|
|
|
|
sharedAttachmentDecl
|
|
: SHARED attachmentDecl
|
|
;
|
|
|
|
attachmentDecl
|
|
: stateDecl
|
|
| edgeDecl
|
|
;
|
|
|
|
stateDecl
|
|
: STATE identifier ID stringLiteral ON identifier COLON valueType
|
|
POLICY storagePolicy (DEFAULT jsonLiteral)? SEMI
|
|
;
|
|
|
|
storagePolicy
|
|
: OPTIMISTIC_REGISTER
|
|
| CRDT LPAREN valueType RPAREN
|
|
;
|
|
|
|
edgeDecl
|
|
: EDGE identifier ID stringLiteral LBRACE edgeEndpoint edgeEndpoint RBRACE
|
|
;
|
|
|
|
edgeEndpoint
|
|
: targetConstraint PROJECTION identifier ID stringLiteral cardinality ORDERED?
|
|
(ON_DELETE stringLiteral)? RETAIN_OTHER? (KEYED stringLiteral)? PUBLIC_TRAVERSAL? SEMI
|
|
;
|
|
|
|
conformanceDecl
|
|
: CONFORM identifier AS identifier (ID stringLiteral)? (SEMANTIC_MAJOR INTEGER)?
|
|
LBRACE conformanceItem* RBRACE
|
|
;
|
|
|
|
conformanceItem
|
|
: PRIVATE attachmentDecl
|
|
| operationBindingDecl
|
|
| relationshipMaterializationDecl
|
|
;
|
|
|
|
relationshipMaterializationDecl
|
|
: MATERIALIZE identifier IF ABSENT USING CONSTRUCTOR identifier VIA EDGE identifier DOT identifier SEMI
|
|
;
|
|
|
|
operationBindingDecl
|
|
: BIND memberOperationRef TO operationProvider SEMI
|
|
;
|
|
|
|
memberOperationRef
|
|
: identifier DOT operationName
|
|
;
|
|
|
|
operationName
|
|
: identifier
|
|
| CALL
|
|
| GET
|
|
| SET
|
|
| RESOLVE
|
|
| CONNECT
|
|
| DISCONNECT
|
|
| WATCH_START
|
|
| WATCH_STOP
|
|
| SUBSCRIBE
|
|
| UNSUBSCRIBE
|
|
;
|
|
|
|
operationProvider
|
|
: STATE identifier DOT statePrimitive
|
|
| EDGE identifier DOT identifier DOT edgePrimitive
|
|
| PACKAGE identifier DOT identifier dependencyBindingBlock?
|
|
;
|
|
|
|
statePrimitive
|
|
: READ
|
|
| WRITE
|
|
| WATCH_START
|
|
| WATCH_STOP
|
|
;
|
|
|
|
edgePrimitive
|
|
: RESOLVE
|
|
| CONNECT
|
|
| DISCONNECT
|
|
| WATCH_START
|
|
| WATCH_STOP
|
|
;
|
|
|
|
dependencyBindingBlock
|
|
: WITH LBRACE dependencyBinding* RBRACE
|
|
;
|
|
|
|
dependencyBinding
|
|
: identifier TO STATE identifier (VIA EDGE identifier DOT identifier)? SEMI
|
|
| identifier TO EDGE identifier DOT identifier (VIA EDGE identifier DOT identifier)? SEMI
|
|
| identifier TO INTERFACE identifier (VIA EDGE identifier DOT identifier)? SEMI
|
|
| identifier TO CONSTRUCTOR identifier SEMI
|
|
;
|
|
|
|
constructorBindingDecl
|
|
: CONSTRUCTOR identifier TO identifier DOT identifier dependencyBindingBlock? SEMI
|
|
;
|
|
|
|
valueType
|
|
: scalarType
|
|
| UNIT
|
|
| WATCH_HANDLE
|
|
| MESSAGE stringLiteral
|
|
| ATOM_REF LT identifier GT
|
|
| INTERFACE_REF LT identifier GT
|
|
| OPTIONAL LT valueType GT
|
|
| LIST LT valueType GT
|
|
;
|
|
|
|
scalarType
|
|
: BOOL
|
|
| BYTES
|
|
| DOUBLE
|
|
| INT32
|
|
| INT64
|
|
| STRING
|
|
| UINT32
|
|
| UINT64
|
|
;
|
|
|
|
cardinality
|
|
: OPTIONAL_ONE
|
|
| EXACTLY_ONE
|
|
| MANY
|
|
| MANY_UNIQUE
|
|
;
|
|
|
|
jsonLiteral
|
|
: stringLiteral
|
|
| INTEGER
|
|
| JSON_NUMBER
|
|
| TRUE
|
|
| FALSE
|
|
| NULL
|
|
| jsonObject
|
|
| jsonArray
|
|
;
|
|
|
|
jsonObject
|
|
: LBRACE (jsonMember (COMMA jsonMember)*)? RBRACE
|
|
;
|
|
|
|
jsonMember
|
|
: stringLiteral COLON jsonLiteral
|
|
;
|
|
|
|
jsonArray
|
|
: LBRACK (jsonLiteral (COMMA jsonLiteral)*)? RBRACK
|
|
;
|
|
|
|
identifier
|
|
: IDENTIFIER
|
|
| SOURCE
|
|
;
|
|
|
|
stringLiteral
|
|
: STRING_LITERAL
|
|
;
|
|
|
|
WORKSPACE: 'workspace';
|
|
FRAGMENT: 'fragment';
|
|
IMPORT: 'import';
|
|
EXTERNAL: 'external';
|
|
ATOM: 'atom';
|
|
INTERFACE: 'interface';
|
|
INTERFACES: 'interfaces';
|
|
PACKAGE: 'package';
|
|
VALUE: 'value';
|
|
RELATION: 'relation';
|
|
OPERATION: 'operation';
|
|
FUNCTION: 'function';
|
|
CONSTRUCTOR: 'constructor';
|
|
CONSTRUCTS: 'constructs';
|
|
INPUT: 'input';
|
|
CONFORM: 'conform';
|
|
AS: 'as';
|
|
BIND: 'bind';
|
|
TO: 'to';
|
|
PRIVATE: 'private';
|
|
SHARED: 'shared';
|
|
STATE: 'state';
|
|
EDGE: 'edge';
|
|
PROJECTION: 'projection';
|
|
WITH: 'with';
|
|
USING: 'using';
|
|
VIA: 'via';
|
|
MATERIALIZE: 'materialize';
|
|
IF: 'if';
|
|
ABSENT: 'absent';
|
|
ON: 'on';
|
|
POLICY: 'policy';
|
|
DEFAULT: 'default';
|
|
SOURCE: 'source';
|
|
REPOSITORY: 'repository';
|
|
COMMIT: 'commit';
|
|
REVISION: 'revision';
|
|
SEMANTIC_MAJOR: 'semantic-major';
|
|
ON_DELETE: 'on-delete';
|
|
RETAIN_OTHER: 'retain-other';
|
|
KEYED: 'keyed';
|
|
PUBLIC_TRAVERSAL: 'public-traversal';
|
|
ID: 'id';
|
|
DOC: 'doc';
|
|
MODE: 'mode';
|
|
EMITS: 'emits';
|
|
RECEIVER: 'receiver';
|
|
REQUIRES: 'requires';
|
|
ANY: 'any';
|
|
GET: 'get';
|
|
SET: 'set';
|
|
WATCH: 'watch';
|
|
START: 'start';
|
|
STOP: 'stop';
|
|
READ: 'read';
|
|
WRITE: 'write';
|
|
RESOLVE: 'resolve';
|
|
CONNECT: 'connect';
|
|
DISCONNECT: 'disconnect';
|
|
CALL: 'call';
|
|
WATCH_START: 'watch-start';
|
|
WATCH_STOP: 'watch-stop';
|
|
SUBSCRIBE: 'subscribe';
|
|
UNSUBSCRIBE: 'unsubscribe';
|
|
OPTIMISTIC_REGISTER: 'optimistic-register';
|
|
CRDT: 'crdt';
|
|
OPTIONAL_ONE: 'optional-one';
|
|
EXACTLY_ONE: 'exactly-one';
|
|
MANY_UNIQUE: 'many-unique';
|
|
MANY: 'many';
|
|
ORDERED: 'ordered';
|
|
UNIT: 'unit';
|
|
WATCH_HANDLE: 'watch-handle';
|
|
MESSAGE: 'message';
|
|
ATOM_REF: 'atom-ref';
|
|
INTERFACE_REF: 'interface-ref';
|
|
OPTIONAL: 'optional';
|
|
LIST: 'list';
|
|
BOOL: 'bool';
|
|
BYTES: 'bytes';
|
|
DOUBLE: 'double';
|
|
INT32: 'int32';
|
|
INT64: 'int64';
|
|
STRING: 'string';
|
|
UINT32: 'uint32';
|
|
UINT64: 'uint64';
|
|
TRUE: 'true';
|
|
FALSE: 'false';
|
|
NULL: 'null';
|
|
|
|
ARROW: '->';
|
|
COLON: ':';
|
|
SEMI: ';';
|
|
COMMA: ',';
|
|
DOT: '.';
|
|
LBRACE: '{';
|
|
RBRACE: '}';
|
|
LBRACK: '[';
|
|
RBRACK: ']';
|
|
LPAREN: '(';
|
|
RPAREN: ')';
|
|
LT: '<';
|
|
GT: '>';
|
|
|
|
INTEGER: '-'? [0-9]+;
|
|
JSON_NUMBER: '-'? ('0' | [1-9] [0-9]*) ('.' [0-9]+)? ([eE] [+-]? [0-9]+)?;
|
|
IDENTIFIER: [A-Za-z_] [A-Za-z0-9_]*;
|
|
STRING_LITERAL: '"' (ESC | ~["\\\r\n])* '"';
|
|
fragment ESC: '\\' (["\\/bfnrt] | 'u' HEX HEX HEX HEX);
|
|
fragment HEX: [0-9a-fA-F];
|
|
|
|
LINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN);
|
|
BLOCK_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
|
|
WS: [ \t\r\n]+ -> channel(HIDDEN);
|