Skip to content

[Query] Abstract Interpretation

github-actions[bot] edited this page Jul 21, 2026 · 1 revision

This document was generated from 'src/documentation/wiki-query.ts' on 2026-07-20, 17:48:26 UTC presenting an overview of flowR's query API (v2.12.3). Please do not edit this file/wiki page directly.

Abstract Interpretation Query [overview]

Returns the abstract values inferred for every expression or at specific locations.
This query is requested with the type absint.
Run in the REPL: :query @absint <inference-type> [(<criteria>)] <code | file://path>

This query infers all shapes of dataframes within the code using abstract interpretaion. For example, you can use:

[ { "type": "absint",   "inference": "df-shape" } ]

Results (prettified and summarized):

Query: absint (5 ms)
   ╰ $7: (colnames: [{"id"}, {}], cols: [1, 1], rows: [3, 3])
   ╰ $14: (colnames: [{"id"}, {}], cols: [1, 1], rows: [0, 3])
   ╰ $0: (colnames: [{"id"}, {}], cols: [1, 1], rows: [0, 3])
All queries together required ≈11 ms (1ms accuracy, total 11 ms)

Show Detailed Results as Json

The analysis required 11.4 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "absint": {
    ".meta": {
      "timing": 5
    },
    "result": {
      "0": {
        "colnames": {
          "must": [
            "id"
          ],
          "may": []
        },
        "cols": [
          1,
          1
        ],
        "rows": [
          0,
          3
        ]
      },
      "7": {
        "colnames": {
          "must": [
            "id"
          ],
          "may": []
        },
        "cols": [
          1,
          1
        ],
        "rows": [
          3,
          3
        ]
      },
      "14": {
        "colnames": {
          "must": [
            "id"
          ],
          "may": []
        },
        "cols": [
          1,
          1
        ],
        "rows": [
          0,
          3
        ]
      }
    }
  },
  ".meta": {
    "timing": 11
  }
}
Original Code
df <- data.frame(id = 1:3) |>
  filter(df, FALSE)
Dataflow Graph of the R Code

The analysis required 3.8 ms (including parse and normalize, using the r-shell engine) within the generation environment. No signature database is mounted for these generated graphs, so library() calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. acf as stats::acf). We encountered no unknown side effects during the analysis.

flowchart LR
    3{{"`*#91;RNumber#93;* **1**
      *1.23* (**id: 3**)`"}}
   %% No edges found for 3
    4{{"`*#91;RNumber#93;* **3**
      *1.25* (**id: 4**)`"}}
   %% No edges found for 4
    5[["`*#91;RBinaryOp#93;* base#58;#58;**#58;**
      *1.23-25* (**id: 5**)
    arg: (3, 4)`"]]
    built-in::["`Built-In:
#58;`"]
    style built-in:: stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    6(["`*#91;RArgument#93;* **id**
      *1.18-19* (**id: 6**)`"])
    7[["`*#91;RFunctionCall#93;* base#58;#58;**data.frame**
      *1.7-26* (**id: 7**)
    arg: (id (6))`"]]
    built-in:data.frame["`Built-In:
data.frame`"]
    style built-in:data.frame stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    10(["`*#91;RSymbol#93;* **df**
      *2.10-11* (**id: 10**)`"])
   %% No edges found for 10
    12{{"`*#91;RLogical#93;* **FALSE**
      *2.14-18* (**id: 12**)`"}}
   %% No edges found for 12
    14[["`*#91;RFunctionCall#93;* stats#58;#58;**filter**
      *2.3-19* (**id: 14**)
    arg: (7, 10, 12)`"]]
    built-in:filter["`Built-In:
filter`"]
    style built-in:filter stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    15[["`*#91;RPipe#93;* **|#62;**
      *1.7-2.19* (**id: 15**)
    arg: (7, 14)`"]]
    built-in:__["`Built-In:
|#62;`"]
    style built-in:__ stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    0["`*#91;RSymbol#93;* **df**
      *1.1-2* (**id: 0**, v: 15)`"]
    16[["`*#91;RBinaryOp#93;* base#58;#58;**#60;#45;**
      *1.1-2.19* (**id: 16**)
    arg: (0, 15)`"]]
    built-in:_-["`Built-In:
#60;#45;`"]
    style built-in:_- stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    5 -->|"reads, arg"| 3
    5 -->|"reads, arg"| 4
    5 -.->|"reads, calls"| built-in::
    linkStyle 2 stroke:gray;
    6 -->|"reads"| 5
    7 -->|"reads, arg"| 6
    7 -.->|"reads, calls"| built-in:data.frame
    linkStyle 5 stroke:gray;
    14 -->|"arg, non-standard-evaluation"| 10
    14 -->|"arg, non-standard-evaluation"| 12
    14 -->|"reads, arg"| 7
    14 -->|"non-standard-evaluation"| 11
    14 -->|"non-standard-evaluation"| 13
    14 -.->|"reads, calls"| built-in:filter
    linkStyle 11 stroke:gray;
    15 -->|"arg"| 7
    15 -->|"returns, arg"| 14
    15 -.->|"reads, calls"| built-in:__
    linkStyle 14 stroke:gray;
    0 -->|"defined-by"| 15
    0 -->|"defined-by"| 16
    16 -->|"reads, arg"| 15
    16 -->|"returns, arg"| 0
    16 -.->|"reads, calls"| built-in:_-
    linkStyle 19 stroke:gray;
Loading

The query optionally also accepts slice criteria to narrow the results to specific nodes. For example:

[ { "type": "absint",   "inference": "df-shape",   "criteria": [ "1@df",    "1@data.frame" ] } ]

(This can be shortened to @absint (1@df;1@data.frame) "df <- data.frame(id = 1:3) |>\n filter(df, FALSE)" when used with the REPL command :query).

Results (prettified and summarized):

Query: absint (2 ms)
   ╰ 1@df: (colnames: [{"id"}, {}], cols: [1, 1], rows: [0, 3])
   ╰ 1@data.frame: (colnames: [{"id"}, {}], cols: [1, 1], rows: [3, 3])
All queries together required ≈7 ms (1ms accuracy, total 7 ms)

Show Detailed Results as Json

The analysis required 7.4 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "absint": {
    ".meta": {
      "timing": 2
    },
    "result": [
      [
        "1@df",
        {
          "colnames": {
            "must": [
              "id"
            ],
            "may": []
          },
          "cols": [
            1,
            1
          ],
          "rows": [
            0,
            3
          ]
        }
      ],
      [
        "1@data.frame",
        {
          "colnames": {
            "must": [
              "id"
            ],
            "may": []
          },
          "cols": [
            1,
            1
          ],
          "rows": [
            3,
            3
          ]
        }
      ]
    ]
  },
  ".meta": {
    "timing": 7
  }
}
Original Code
df <- data.frame(id = 1:3) |>
  filter(df, FALSE)
Dataflow Graph of the R Code

The analysis required 6.4 ms (including parse and normalize, using the r-shell engine) within the generation environment. No signature database is mounted for these generated graphs, so library() calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. acf as stats::acf). We encountered no unknown side effects during the analysis.

flowchart LR
    3{{"`*#91;RNumber#93;* **1**
      *1.23* (**id: 3**)`"}}
   %% No edges found for 3
    4{{"`*#91;RNumber#93;* **3**
      *1.25* (**id: 4**)`"}}
   %% No edges found for 4
    5[["`*#91;RBinaryOp#93;* base#58;#58;**#58;**
      *1.23-25* (**id: 5**)
    arg: (3, 4)`"]]
    built-in::["`Built-In:
#58;`"]
    style built-in:: stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    6(["`*#91;RArgument#93;* **id**
      *1.18-19* (**id: 6**)`"])
    7[["`*#91;RFunctionCall#93;* base#58;#58;**data.frame**
      *1.7-26* (**id: 7**)
    arg: (id (6))`"]]
    built-in:data.frame["`Built-In:
data.frame`"]
    style built-in:data.frame stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    10(["`*#91;RSymbol#93;* **df**
      *2.10-11* (**id: 10**)`"])
   %% No edges found for 10
    12{{"`*#91;RLogical#93;* **FALSE**
      *2.14-18* (**id: 12**)`"}}
   %% No edges found for 12
    14[["`*#91;RFunctionCall#93;* stats#58;#58;**filter**
      *2.3-19* (**id: 14**)
    arg: (7, 10, 12)`"]]
    built-in:filter["`Built-In:
filter`"]
    style built-in:filter stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    15[["`*#91;RPipe#93;* **|#62;**
      *1.7-2.19* (**id: 15**)
    arg: (7, 14)`"]]
    built-in:__["`Built-In:
|#62;`"]
    style built-in:__ stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    0["`*#91;RSymbol#93;* **df**
      *1.1-2* (**id: 0**, v: 15)`"]
    16[["`*#91;RBinaryOp#93;* base#58;#58;**#60;#45;**
      *1.1-2.19* (**id: 16**)
    arg: (0, 15)`"]]
    built-in:_-["`Built-In:
#60;#45;`"]
    style built-in:_- stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
    5 -->|"reads, arg"| 3
    5 -->|"reads, arg"| 4
    5 -.->|"reads, calls"| built-in::
    linkStyle 2 stroke:gray;
    6 -->|"reads"| 5
    7 -->|"reads, arg"| 6
    7 -.->|"reads, calls"| built-in:data.frame
    linkStyle 5 stroke:gray;
    14 -->|"arg, non-standard-evaluation"| 10
    14 -->|"arg, non-standard-evaluation"| 12
    14 -->|"reads, arg"| 7
    14 -->|"non-standard-evaluation"| 11
    14 -->|"non-standard-evaluation"| 13
    14 -.->|"reads, calls"| built-in:filter
    linkStyle 11 stroke:gray;
    15 -->|"arg"| 7
    15 -->|"returns, arg"| 14
    15 -.->|"reads, calls"| built-in:__
    linkStyle 14 stroke:gray;
    0 -->|"defined-by"| 15
    0 -->|"defined-by"| 16
    16 -->|"reads, arg"| 15
    16 -->|"returns, arg"| 0
    16 -.->|"reads, calls"| built-in:_-
    linkStyle 19 stroke:gray;
Loading
Implementation Details

Responsible for the execution of the Abstract Interpretation Query query is executeAbsintQuery in ./src/queries/catalog/absint-query/absint-query-format.ts.

Clone this wiki locally