8000 Full-fidelity AST schema: named args, call blocks, patterns, bodies · Issue #135 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

Full-fidelity AST schema: named args, call blocks, patterns, bodies #135

Closed

Description

@akoskovacs

Part of #131. Blocked by #133 (do the fidelity work once, on both sinks).

The exposed schema covers roughly 25 of the 43 ast::Expr variants (src/ast/ast.hxx), and drops information even from the ones it covers. This is the stage that makes it the real AST rather than a reporting view, and it is deliberately incremental — each group below is a landable commit.

Because #133 puts both backends behind one converter, every item here lands on the interpreter and BEAM at once.

Groups, ordered by who is blocked

  • Call / MethodCall: named arguments and block arguments. Both are already on ast::FunctionCall and ast::MethodCall (src/ast/ast.hxx:183, :196) as namedArgs and block, and both are simply dropped in conversion. Today bundle "demo" do ... end becomes Call(Identifier("bundle"), [LitString("demo")]) with the manifest's entire contents missing, and tey("greet", git: ..., tag: ...) loses its arguments. Unblocks Tey (Rename to Kex.AST; migrate docgen and Tey's manifest reader #137).
  • Patterns. Match carries (PatternRef, Expression) pairs and guards, not just arm bodies. Let carries a real pattern instead of a name string scraped out of VarPattern.
  • The uncovered Expr variants: MapExpr, ReceiveExpr, SpawnExpr, TryExpr, TryingExpr, CurryExpr, CurryPlaceholder, RecordConstruction, ThenElseExpr, BreakExpr, NextExpr, ShorthandLambda, UpperIdentifier, ThisExpr, CharLiteral, UsingExpr, GeneratedDecl, ErrorNode.
  • Declaration detail: function clause bodies, rescue blocks, and the distinctions src/ast/ast.hxx explicitly documents as semantic — FunctionClause::hasParamList (let x = 3 is a binding, let x() = 3 is a nullary function) and MethodCall::parenthesized (a function reference vs. a call to it).

Schema versioning

Program gains schemaVersion : Integer, bumped by each group. Consumers can then refuse a schema they do not understand instead of misreading it.

Verification

  • make test-all, every spec under both backends.
  • An exhaustiveness test mapping each ast::Expr variant to its schema counterpart, so that adding a node to the C++ AST fails the build rather than silently vanishing from the exposed one. This is the mechanism that keeps src/stdlib/ast.kex canonical rather than aspirational.

Activity

  1. added a commit that references this issue on Aug 21, 2026
    cf2946e
  2. added this to the 0.4.0 milestone on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0