c3a826b65c
PHASE A: Safe predicate evaluator (glyphos/control/predicate.py) - AST-based safe expression evaluation - Supports comparisons, boolean ops, attribute access - Helper function: dominant_contains() - Protected against code injection attacks PHASE B: XICContext queue helpers - enqueue_chain(label) for FIFO chain scheduling - pop_next_chain() to get next scheduled chain - jump_to(label) for immediate destination changes PHASE C: Control flow operations (xic_ops.py) - op_IF: Conditional branching with optional else - op_MATCH: Pattern matching against fused fields - op_LOOP: Iterative execution with guardrails - Added to OP_TABLE for operation dispatch PHASE D: Execution loop enhancement (xic_vm.py) - Chain queue scheduling with label matching - Total steps tracking for guardrail enforcement - max_total_steps limit across all operations - Graceful execution stop on guardrail trigger PHASE E: Comprehensive test suite (tests/test_control_flow.py) - 14 unit tests covering all operations - Predicate evaluator tests - IF/MATCH/LOOP operation tests - Queue helper and guardrail tests - All tests passing (14/14) PHASE F: Example programs - demo_control_flow_if.gx.json: IF branching example - demo_control_flow_loop.gx.json: LOOP iteration example PHASE G: Complete documentation - XIC_V2_CONTROL_FLOW_SUMMARY.md: Technical guide - XIC_V2_QUICK_REFERENCE.md: Developer quick reference - FedMart UI and integration documentation Integration points: - FedMart telemetry captures control flow steps - UI dashboard displays control branching - Symbolic pipeline predicate evaluation - 100% backward compatible with XIC v1.5 Test results: 36/36 passing (14 control flow + 12 FedMart + 10 UI) Status: Production ready
70 lines
1.3 KiB
JSON
70 lines
1.3 KiB
JSON
{
|
|
"magic": "GXIC1",
|
|
"version": 1,
|
|
"model": "",
|
|
"entrypoint": "main",
|
|
"symbols": {
|
|
"main": 0,
|
|
"loop_body": 7,
|
|
"end": 12
|
|
},
|
|
"instructions": [
|
|
{
|
|
"op": "SET_MODE",
|
|
"args": ["symbolic"]
|
|
},
|
|
{
|
|
"op": "SET_CONTEXT",
|
|
"args": ["domain", "iterative_analysis"]
|
|
},
|
|
{
|
|
"op": "SET_PARAM",
|
|
"args": ["max_loop_iterations", 5]
|
|
},
|
|
{
|
|
"op": "SET_PARAM",
|
|
"args": ["max_total_steps", 100]
|
|
},
|
|
{
|
|
"op": "LOG",
|
|
"args": ["Starting iterative symbolic analysis with LOOP control flow"]
|
|
},
|
|
{
|
|
"op": "PUSH_GLYPH_CONTEXT",
|
|
"args": ["glyph://analysis"]
|
|
},
|
|
{
|
|
"op": "LOOP",
|
|
"args": ["fused.global_resonance_score > 0.6", "loop_body", 5]
|
|
},
|
|
{
|
|
"op": "CHAIN",
|
|
"args": ["loop_body"]
|
|
},
|
|
{
|
|
"op": "RUN_PROMPT",
|
|
"args": ["Analyze the current symbolic state and refine understanding"]
|
|
},
|
|
{
|
|
"op": "GET_GLYPH_RESONANCE",
|
|
"args": ["glyph://analysis", "global"]
|
|
},
|
|
{
|
|
"op": "LOG",
|
|
"args": ["Iteration complete, checking resonance score"]
|
|
},
|
|
{
|
|
"op": "CHAIN",
|
|
"args": ["end"]
|
|
},
|
|
{
|
|
"op": "CHAIN",
|
|
"args": ["end"]
|
|
},
|
|
{
|
|
"op": "LOG",
|
|
"args": ["LOOP control flow demonstration complete"]
|
|
}
|
|
]
|
|
}
|