Add pipe operator, with-update, retry/fallback, reason, parallel, trace, contract, deploy

Implements 8 new language features:
- |> pipe operator: a |> f desugars to f(a), left-associative chains
- with record update: let b = a with { field: val } — non-destructive struct update
- retry/fallback: retry N times { ... } fallback { ... } with counter-based loop codegen
- reason: AI inference primitive calling soma /v1/chat/completions at runtime
- parallel: concurrent execution block returning a Map of named results via threads
- trace: zero-cost observability block emitting TraceBegin/TraceEnd with ms timing
- requires: precondition annotation on fn, emits ContractCheck bytecode at entry
- deploy: deployment-as-syntax posting to soma /v1/deploy at runtime

All features thread through lexer → parser/AST → codegen → runtime interpreter.
This commit is contained in:
Will Anderson
2026-04-28 12:04:45 -05:00
parent f2202e0e5e
commit afd99f5e0d
10 changed files with 868 additions and 59 deletions
+13
View File
@@ -191,6 +191,13 @@ impl TypeChecker {
});
}
}
Stmt::Retry { body, fallback, .. } => {
for s in body { self.check_stmt(s); }
if let Some(fb) = fallback {
for s in fb { self.check_stmt(s); }
}
}
Stmt::Deploy { .. } => {}
}
}
@@ -476,6 +483,12 @@ impl TypeChecker {
}
}
}
// Engram-specific expressions
Expr::With { base, .. } => self.infer_expr(base),
Expr::Reason { .. } => Type::String,
Expr::Parallel { .. } => Type::Unknown,
Expr::Trace { .. } => Type::Unknown,
}
}