Tier 3 • Compiler Assembly Pipeline Hub

The Story of declarative-instructions

How declarative AST transformation rules replaced imperative rendering loops—allowing compilers to assemble complex HTML from pure JSON instructions.

Launch V1 Instructions Studio →

Decoupling the "How" from Compiler Code

In traditional web development, a compiler contains hundreds of lines of imperative DOM traversal code: finding containers, creating child elements, iterating arrays, and appending nodes.

When the DOM structure changes (e.g., migrating from table colgroups to CSS subgrid or wrapping cells in divs), engineers are forced to rewrite compiler source code. declarative-instructions solved this by inventing declarative assembly instructions.

The 4-Part Instruction Contract

Every instruction in instructions.json declares what to do without writing a single loop:

  • destinationPath: A JSONPath query pointing to where elements mount ($..*[?@.attributes['data-role'] == 'headerRoot']).
  • sourcePath: Where input data is read from (e.g., $.columns or $.data).
  • templateKey: Key in declarative-spec used as the cloneable tag prototype.
  • func: Standard mapping function (fromCollection, oneDimension, etc.).

Instruction Rule Example

{
  "buildHeader": [
    {
      "destinationPath": "$",
      "templateKey": "buildHeader",
      "type": "single"
    },
    {
      "destinationPath": "$..*[?@.attributes['data-role'] == 'headerRoot']",
      "sourcePath": "$.columns",
      "templateKey": "buildHeaderCell",
      "func": "fromCollection"
    }
  ]
}
declarative-instructions v1.0.0