Skip to content

Unnest to LET (spec 0009) #269

Description

@jimmytacks

Parent issue for spec 0009 — Unnest to LET (specs/0009-unnest-to-let.md).

A new /Unnest slash command that takes a nested formula and explodes each function call and operator expression into a named LET step (leaf-first), making intermediate values inspectable for debugging. It is the complement to /Refactor (spec 0008): /Refactor hoists leaves into input bindings; /Unnest hoists intermediate calculations into step bindings. The two compose — /Unnest then /Refactor then /LET to LAMBDA.

Key design decisions (approved):

  • Separate, composing command — reuses RefactorEngine's existing calc-binding ref-hoisting for the input half (zero new code there).
  • Max granularity, then collapse — every function/operator node becomes a step; an Include toggle inlines unwanted ones.
  • Function-derived step namessumsq1, sqrt1, round1; operator steps calcN.
  • No CSE in v1 — the step tree mirrors the syntax tree.
  • Introduces the repo's first recursive-descent formula parser (AST) — the main new engine and risk area.

Tasks

Build order: #270 -> #271 -> #272 -> #273.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions