@eagleoutice/flowr 2.6.2 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -34
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/data-frame/absint-visitor.js +6 -6
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +4 -7
- package/abstract-interpretation/data-frame/dataframe-domain.js +5 -11
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +3 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +3 -2
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +3 -1
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +3 -2
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +7 -7
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +28 -24
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +3 -1
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +3 -2
- package/abstract-interpretation/data-frame/semantics.js +54 -41
- package/abstract-interpretation/data-frame/shape-inference.d.ts +3 -3
- package/abstract-interpretation/data-frame/shape-inference.js +3 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -0
- package/abstract-interpretation/domains/abstract-domain.js +3 -2
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
- package/abstract-interpretation/domains/interval-domain.js +3 -6
- package/abstract-interpretation/domains/lattice.d.ts +2 -0
- package/abstract-interpretation/domains/lattice.js +3 -1
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/positive-interval-domain.js +1 -1
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +2 -2
- package/abstract-interpretation/domains/satisfiable-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +98 -0
- package/abstract-interpretation/domains/set-range-domain.js +400 -0
- package/abstract-interpretation/domains/set-upper-bound-domain.js +2 -2
- package/abstract-interpretation/domains/singleton-domain.js +2 -2
- package/abstract-interpretation/normalized-ast-fold.d.ts +1 -1
- package/benchmark/slicer.d.ts +3 -1
- package/benchmark/slicer.js +50 -27
- package/benchmark/stats/print.js +8 -5
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/summarizer/data.d.ts +11 -8
- package/benchmark/summarizer/first-phase/process.js +12 -9
- package/benchmark/summarizer/second-phase/graph.d.ts +3 -1
- package/benchmark/summarizer/second-phase/graph.js +3 -1
- package/benchmark/summarizer/second-phase/process.js +24 -18
- package/cli/export-quads-app.js +1 -1
- package/cli/repl/commands/repl-dataflow.js +2 -1
- package/cli/repl/commands/repl-parse.js +16 -4
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/core.js +16 -13
- package/cli/repl/server/connection.js +2 -1
- package/cli/script-core/statistics-helper-core.js +2 -1
- package/cli/slicer-app.js +3 -4
- package/cli/wiki.d.ts +4 -0
- package/cli/wiki.js +165 -0
- package/config.d.ts +4 -0
- package/config.js +6 -0
- package/control-flow/cfg-dead-code.js +14 -3
- package/control-flow/cfg-simplification.d.ts +5 -2
- package/control-flow/cfg-simplification.js +3 -0
- package/control-flow/extract-cfg.d.ts +9 -3
- package/control-flow/extract-cfg.js +44 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +2 -2
- package/control-flow/simple-visitor.js +2 -2
- package/control-flow/useless-loop.d.ts +3 -3
- package/control-flow/useless-loop.js +16 -5
- package/core/pipeline-executor.d.ts +3 -6
- package/core/pipeline-executor.js +4 -7
- package/core/print/normalize-printer.d.ts +1 -1
- package/core/print/normalize-printer.js +2 -2
- package/core/steps/all/core/00-parse.d.ts +1 -1
- package/core/steps/all/core/00-parse.js +1 -1
- package/core/steps/all/core/10-normalize.d.ts +3 -9
- package/core/steps/all/core/10-normalize.js +1 -16
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -3
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -3
- package/core/steps/all/core/20-dataflow.d.ts +3 -4
- package/core/steps/all/core/20-dataflow.js +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +4 -2
- package/core/steps/all/static-slicing/00-slice.js +3 -2
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +8 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +4 -1
- package/core/steps/pipeline/default-pipelines.d.ts +94 -95
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/append.d.ts +5 -0
- package/dataflow/environments/append.js +6 -20
- package/dataflow/environments/built-in.d.ts +2 -1
- package/dataflow/environments/clone.d.ts +1 -2
- package/dataflow/environments/clone.js +3 -17
- package/dataflow/environments/define.d.ts +7 -3
- package/dataflow/environments/define.js +9 -56
- package/dataflow/environments/diff.js +3 -3
- package/dataflow/environments/environment.d.ts +48 -28
- package/dataflow/environments/environment.js +187 -62
- package/dataflow/environments/overwrite.d.ts +1 -5
- package/dataflow/environments/overwrite.js +2 -61
- package/dataflow/environments/reference-to-maybe.d.ts +13 -0
- package/dataflow/environments/reference-to-maybe.js +54 -0
- package/dataflow/environments/resolve-by-name.d.ts +6 -1
- package/dataflow/environments/resolve-by-name.js +56 -4
- package/dataflow/environments/scoping.d.ts +8 -4
- package/dataflow/environments/scoping.js +13 -9
- package/dataflow/eval/resolve/alias-tracking.d.ts +10 -4
- package/dataflow/eval/resolve/alias-tracking.js +15 -13
- package/dataflow/eval/resolve/resolve-argument.d.ts +2 -1
- package/dataflow/eval/resolve/resolve-argument.js +10 -10
- package/dataflow/eval/resolve/resolve.d.ts +13 -11
- package/dataflow/eval/resolve/resolve.js +16 -15
- package/dataflow/eval/values/string/string-constants.d.ts +9 -3
- package/dataflow/eval/values/string/string-constants.js +9 -3
- package/dataflow/extractor.d.ts +2 -3
- package/dataflow/extractor.js +25 -28
- package/dataflow/fn/higher-order-function.d.ts +2 -1
- package/dataflow/fn/higher-order-function.js +4 -4
- package/dataflow/graph/dataflowgraph-builder.d.ts +9 -5
- package/dataflow/graph/dataflowgraph-builder.js +21 -11
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/graph.d.ts +13 -11
- package/dataflow/graph/graph.js +40 -24
- package/dataflow/graph/invert-dfg.d.ts +3 -2
- package/dataflow/graph/invert-dfg.js +3 -3
- package/dataflow/graph/resolve-graph.d.ts +2 -1
- package/dataflow/graph/resolve-graph.js +2 -2
- package/dataflow/graph/unknown-replacement.d.ts +4 -2
- package/dataflow/graph/unknown-replacement.js +4 -2
- package/dataflow/graph/vertex.d.ts +3 -3
- package/dataflow/graph/vertex.js +3 -3
- package/dataflow/info.d.ts +8 -1
- package/dataflow/info.js +21 -0
- package/dataflow/internal/linker.js +10 -11
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -2
- package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -3
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +7 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +12 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +10 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +8 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +15 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +78 -75
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -5
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +6 -7
- package/dataflow/internal/process/functions/call/default-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -4
- package/dataflow/internal/process/functions/call/named-call-handling.js +4 -4
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
- package/dataflow/internal/process/functions/process-argument.js +1 -1
- package/dataflow/internal/process/functions/process-parameter.js +4 -4
- package/dataflow/internal/process/process-symbol.js +1 -1
- package/dataflow/internal/process/process-value.d.ts +1 -1
- package/dataflow/internal/process/process-value.js +7 -7
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
- package/dataflow/processor.d.ts +7 -16
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +0 -2
- package/documentation/data/faq/faqs.js +27 -18
- package/documentation/data/faq/recommended-configs.d.ts +36 -0
- package/documentation/data/faq/recommended-configs.js +40 -0
- package/documentation/data/faq/wiki-faq-store.d.ts +1 -0
- package/documentation/data/faq/wiki-faq-store.js +10 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-capabilities.d.ts +9 -0
- package/documentation/{print-capabilities-markdown.js → doc-capabilities.js} +18 -21
- package/documentation/doc-readme.d.ts +9 -0
- package/documentation/{print-readme.js → doc-readme.js} +31 -35
- package/documentation/doc-util/doc-benchmarks.d.ts +6 -4
- package/documentation/doc-util/doc-benchmarks.js +6 -4
- package/documentation/doc-util/doc-cfg.js +5 -8
- package/documentation/doc-util/doc-dfg.d.ts +7 -7
- package/documentation/doc-util/doc-dfg.js +15 -14
- package/documentation/doc-util/doc-escape.d.ts +6 -0
- package/documentation/doc-util/doc-escape.js +11 -0
- package/documentation/doc-util/doc-general.d.ts +22 -2
- package/documentation/doc-util/doc-general.js +22 -2
- package/documentation/doc-util/doc-normalized-ast.d.ts +10 -5
- package/documentation/doc-util/doc-normalized-ast.js +14 -10
- package/documentation/doc-util/doc-query.d.ts +12 -4
- package/documentation/doc-util/doc-query.js +18 -11
- package/documentation/doc-util/doc-search.d.ts +0 -30
- package/documentation/doc-util/doc-search.js +2 -73
- package/documentation/doc-util/doc-server-message.d.ts +5 -5
- package/documentation/doc-util/doc-server-message.js +4 -4
- package/documentation/doc-util/doc-types.d.ts +69 -32
- package/documentation/doc-util/doc-types.js +109 -62
- package/documentation/index.d.ts +9 -9
- package/documentation/index.js +9 -9
- package/documentation/issue-linting-rule.d.ts +9 -0
- package/documentation/{print-linter-issue.js → issue-linting-rule.js} +20 -23
- package/documentation/wiki-analyzer.d.ts +9 -0
- package/documentation/wiki-analyzer.js +425 -0
- package/documentation/wiki-cfg.d.ts +9 -0
- package/documentation/{print-cfg-wiki.js → wiki-cfg.js} +144 -160
- package/documentation/wiki-core.d.ts +14 -0
- package/documentation/{print-core-wiki.js → wiki-core.js} +164 -175
- package/documentation/wiki-dataflow-graph.d.ts +9 -0
- package/documentation/{print-dataflow-graph-wiki.js → wiki-dataflow-graph.js} +146 -177
- package/documentation/wiki-engine.d.ts +9 -0
- package/documentation/{print-engines-wiki.js → wiki-engine.js} +27 -42
- package/documentation/wiki-faq.d.ts +8 -0
- package/documentation/wiki-faq.js +21 -0
- package/documentation/wiki-interface.d.ts +9 -0
- package/documentation/{print-interface-wiki.js → wiki-interface.js} +59 -56
- package/documentation/wiki-linter.d.ts +9 -0
- package/documentation/{print-linter-wiki.js → wiki-linter.js} +52 -48
- package/documentation/wiki-linting-and-testing.d.ts +9 -0
- package/documentation/{print-linting-and-testing-wiki.js → wiki-linting-and-testing.js} +25 -32
- package/documentation/wiki-mk/doc-context.d.ts +186 -0
- package/documentation/wiki-mk/doc-context.js +84 -0
- package/documentation/wiki-mk/doc-maker.d.ts +95 -0
- package/documentation/wiki-mk/doc-maker.js +134 -0
- package/documentation/wiki-normalized-ast.d.ts +9 -0
- package/documentation/{print-normalized-ast-wiki.js → wiki-normalized-ast.js} +64 -47
- package/documentation/wiki-onboarding.d.ts +8 -0
- package/documentation/{print-onboarding-wiki.js → wiki-onboarding.js} +18 -15
- package/documentation/wiki-query.d.ts +9 -0
- package/documentation/{print-query-wiki.js → wiki-query.js} +62 -47
- package/documentation/wiki-search.d.ts +9 -0
- package/documentation/wiki-search.js +61 -0
- package/linter/linter-executor.js +3 -2
- package/linter/linter-format.d.ts +2 -2
- package/linter/linter-rules.d.ts +15 -19
- package/linter/rules/absolute-path.d.ts +1 -2
- package/linter/rules/absolute-path.js +5 -5
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +13 -9
- package/linter/rules/dead-code.d.ts +1 -1
- package/linter/rules/deprecated-functions.d.ts +1 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/file-path-validity.js +4 -4
- package/linter/rules/function-finder-util.d.ts +3 -7
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +4 -3
- package/linter/rules/seeded-randomness.js +38 -18
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/useless-loop.d.ts +2 -2
- package/linter/rules/useless-loop.js +2 -2
- package/package.json +5 -17
- package/project/cache/flowr-analyzer-cache.d.ts +7 -10
- package/project/cache/flowr-analyzer-cache.js +17 -38
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +34 -0
- package/project/cache/flowr-analyzer-controlflow-cache.js +79 -0
- package/project/context/flowr-analyzer-context.d.ts +37 -5
- package/project/context/flowr-analyzer-context.js +51 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +47 -0
- package/project/context/flowr-analyzer-environment-context.js +50 -0
- package/project/context/flowr-analyzer-files-context.d.ts +63 -13
- package/project/context/flowr-analyzer-files-context.js +110 -39
- package/project/context/flowr-file.d.ts +32 -10
- package/project/context/flowr-file.js +30 -9
- package/project/flowr-analyzer-builder.d.ts +22 -28
- package/project/flowr-analyzer-builder.js +32 -70
- package/project/flowr-analyzer.d.ts +55 -14
- package/project/flowr-analyzer.js +53 -8
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +7 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +13 -5
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +3 -3
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +11 -5
- package/project/plugins/file-plugins/flowr-description-file.d.ts +3 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.d.ts +20 -0
- package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.js +42 -0
- package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.d.ts +59 -0
- package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.js +132 -0
- package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
- package/project/plugins/file-plugins/notebooks/notebook.js +2 -0
- package/project/plugins/flowr-analyzer-plugin-defaults.d.ts +5 -0
- package/project/plugins/flowr-analyzer-plugin-defaults.js +23 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +2 -0
- package/project/plugins/flowr-analyzer-plugin.js +2 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/plugin-registry.d.ts +34 -0
- package/project/plugins/plugin-registry.js +62 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +5 -6
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +5 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -18
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.js +3 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +5 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +6 -6
- package/queries/catalog/df-shape-query/df-shape-query-format.js +8 -7
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +4 -4
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +13 -2
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -1
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +3 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +13 -1
- package/queries/query.d.ts +26 -18
- package/queries/query.js +21 -1
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/collect.js +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +29 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +15 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +5 -7
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +24 -11
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/type.js +2 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +9 -8
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +11 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +4 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +20 -11
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +5 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +14 -5
- package/r-bridge/parser.d.ts +15 -5
- package/r-bridge/parser.js +27 -13
- package/r-bridge/retriever.d.ts +9 -15
- package/r-bridge/retriever.js +14 -5
- package/r-bridge/shell.d.ts +1 -1
- package/r-bridge/shell.js +1 -1
- package/reconstruct/auto-select/auto-select-defaults.d.ts +0 -1
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/reconstruct/reconstruct.d.ts +17 -9
- package/reconstruct/reconstruct.js +19 -8
- package/search/flowr-search.d.ts +12 -0
- package/search/search-executor/search-enrichers.d.ts +9 -2
- package/search/search-executor/search-enrichers.js +1 -3
- package/search/search-executor/search-generators.d.ts +1 -1
- package/search/search-executor/search-generators.js +9 -4
- package/slicing/criterion/collect-all.d.ts +3 -2
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/criterion/parse.js +4 -4
- package/slicing/static/slice-call.d.ts +3 -2
- package/slicing/static/slice-call.js +4 -4
- package/slicing/static/static-slicer.d.ts +3 -1
- package/slicing/static/static-slicer.js +6 -7
- package/statistics/features/supported/assignments/assignments.js +1 -1
- package/statistics/features/supported/control-flow/control-flow.js +2 -2
- package/statistics/features/supported/data-access/data-access.js +1 -1
- package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
- package/statistics/features/supported/expression-list/statistics-expression-list.js +1 -1
- package/statistics/features/supported/loops/loops.js +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +2 -2
- package/statistics/features/supported/variables/variables.js +3 -2
- package/statistics/statistics.js +3 -2
- package/util/assert.d.ts +4 -0
- package/util/assert.js +4 -0
- package/util/containers.js +1 -1
- package/util/files.d.ts +1 -1
- package/util/files.js +1 -1
- package/util/mermaid/ast.d.ts +4 -3
- package/util/mermaid/ast.js +36 -8
- package/util/mermaid/cfg.js +1 -1
- package/util/mermaid/dfg.d.ts +1 -0
- package/util/mermaid/dfg.js +3 -3
- package/util/simple-df/dfg-view.d.ts +2 -1
- package/util/simple-df/dfg-view.js +2 -2
- package/util/version.js +1 -1
- package/dataflow/environments/remove.d.ts +0 -12
- package/dataflow/environments/remove.js +0 -52
- package/documentation/print-analyzer-wiki.d.ts +0 -1
- package/documentation/print-analyzer-wiki.js +0 -141
- package/documentation/print-capabilities-markdown.d.ts +0 -1
- package/documentation/print-cfg-wiki.d.ts +0 -1
- package/documentation/print-core-wiki.d.ts +0 -5
- package/documentation/print-dataflow-graph-wiki.d.ts +0 -1
- package/documentation/print-engines-wiki.d.ts +0 -1
- package/documentation/print-faq-wiki.d.ts +0 -1
- package/documentation/print-faq-wiki.js +0 -18
- package/documentation/print-interface-wiki.d.ts +0 -1
- package/documentation/print-linter-issue.d.ts +0 -1
- package/documentation/print-linter-wiki.d.ts +0 -1
- package/documentation/print-linting-and-testing-wiki.d.ts +0 -1
- package/documentation/print-normalized-ast-wiki.d.ts +0 -1
- package/documentation/print-onboarding-wiki.d.ts +0 -1
- package/documentation/print-query-wiki.d.ts +0 -1
- package/documentation/print-readme.d.ts +0 -1
- package/documentation/print-search-wiki.d.ts +0 -1
- package/documentation/print-search-wiki.js +0 -74
- package/util/formats/adapter-format.d.ts +0 -6
- package/util/formats/adapter-format.js +0 -3
- package/util/formats/adapter.d.ts +0 -27
- package/util/formats/adapter.js +0 -58
- package/util/formats/adapters/r-adapter.d.ts +0 -4
- package/util/formats/adapters/r-adapter.js +0 -7
- package/util/formats/adapters/rmd-adapter.d.ts +0 -35
- package/util/formats/adapters/rmd-adapter.js +0 -100
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const log_1 = require("../../test/functionality/_helper/log");
|
|
8
|
-
const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
|
|
9
|
-
const doc_code_1 = require("./doc-util/doc-code");
|
|
10
|
-
const doc_types_1 = require("./doc-util/doc-types");
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
3
|
+
exports.WikiCfg = void 0;
|
|
12
4
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
13
5
|
const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
14
6
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
@@ -32,7 +24,10 @@ const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guid
|
|
|
32
24
|
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
33
25
|
const edge_1 = require("../dataflow/graph/edge");
|
|
34
26
|
const assert_1 = require("../util/assert");
|
|
35
|
-
const
|
|
27
|
+
const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-context");
|
|
28
|
+
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
29
|
+
const doc_general_1 = require("./doc-util/doc-general");
|
|
30
|
+
const doc_code_1 = require("./doc-util/doc-code");
|
|
36
31
|
const CfgLongExample = `f <- function(a, b = 3) {
|
|
37
32
|
if(a > b) {
|
|
38
33
|
return(a * b);
|
|
@@ -104,8 +99,8 @@ class CollectNumbersDataflowVisitor extends dfg_cfg_guided_visitor_1.DataflowAwa
|
|
|
104
99
|
}
|
|
105
100
|
class CollectSourcesSemanticVisitor extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {
|
|
106
101
|
sources = [];
|
|
107
|
-
constructor(controlFlow, normalizedAst, dataflow,
|
|
108
|
-
super({ controlFlow, normalizedAst, dfg: dataflow,
|
|
102
|
+
constructor(controlFlow, normalizedAst, dataflow, ctx) {
|
|
103
|
+
super({ controlFlow, normalizedAst, dfg: dataflow, ctx, defaultVisitingOrder: 'forward' });
|
|
109
104
|
}
|
|
110
105
|
onAssignmentCall({ source }) {
|
|
111
106
|
if (source) {
|
|
@@ -116,33 +111,30 @@ class CollectSourcesSemanticVisitor extends semantic_cfg_guided_visitor_1.Semant
|
|
|
116
111
|
return this.sources;
|
|
117
112
|
}
|
|
118
113
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
return `${(0, doc_auto_gen_1.autoGenHeader)({ filename: module.filename, purpose: 'control flow graph', rVersion: rversion })}
|
|
130
|
-
|
|
114
|
+
/**
|
|
115
|
+
* https://github.com/flowr-analysis/flowr/wiki/Control-Flow-Graph
|
|
116
|
+
*/
|
|
117
|
+
class WikiCfg extends doc_maker_1.DocMaker {
|
|
118
|
+
constructor() {
|
|
119
|
+
super('wiki/Control Flow Graph.md', module.filename, 'control flow graph');
|
|
120
|
+
}
|
|
121
|
+
async text({ ctx, shell }) {
|
|
122
|
+
return `
|
|
131
123
|
_flowR_ produces three main perspectives of the program: 1) a [normalized version of the AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST)
|
|
132
124
|
and 2) a [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph), and 3) a control flow graph (CFG).
|
|
133
125
|
flowR uses this CFG interweaved with its data flow analysis and for some of its queries (e.g., to link to the last call in a [Call-Context Query](${doc_files_1.FlowrWikiBaseRef}/Query-API)).
|
|
134
126
|
|
|
135
127
|
Please note that, mostly due to historical reasons, the [control dependencies](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph#control-dependencies) that are stored directly within the
|
|
136
128
|
DFG provide only a partial view of the CFG. While they provide you with information on the conditional execution of vertices, they do not encode the order of execution.
|
|
137
|
-
In contrast, the CFG describes a complete view of the program's control flow.
|
|
129
|
+
In contrast, the CFG describes a complete view of the program's control flow.
|
|
138
130
|
|
|
139
131
|
${(0, doc_structure_1.block)({
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
type: 'TIP',
|
|
133
|
+
content: `If you want to investigate the Control Flow Graph,
|
|
142
134
|
you can use the ${(0, doc_cli_option_1.getReplCommand)('controlflow*')} command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information).
|
|
143
135
|
By default, this view does _not_ use basic blocks as, for example, R allows unconditional jumps to occur in spots where conventional languages would assume expressions (e.g., if-conditions).
|
|
144
136
|
Yet, by using ${(0, doc_cli_option_1.getReplCommand)('controlflowbb*')} you can inspect the CFG with basic blocks (although you have to keep in mind that now, there can be a value flow between basic blocks)`
|
|
145
|
-
|
|
137
|
+
})}
|
|
146
138
|
|
|
147
139
|
For readability, we structure this wiki page into various segments:
|
|
148
140
|
|
|
@@ -157,7 +149,6 @@ For readability, we structure this wiki page into various segments:
|
|
|
157
149
|
- [Sophisticated CFG Traversal](#cfg-traversal)
|
|
158
150
|
- [Working With Exit Points](#cfg-exit-points)
|
|
159
151
|
|
|
160
|
-
|
|
161
152
|
${(0, doc_structure_1.section)('Initial Overview', 2, 'cfg-overview')}
|
|
162
153
|
|
|
163
154
|
For now, let's look at a CFG for a program without any branching:
|
|
@@ -169,9 +160,9 @@ The corresponding CFG is a directed, labeled graph with two types of edges (cont
|
|
|
169
160
|
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n' })}
|
|
170
161
|
|
|
171
162
|
${(0, doc_structure_1.block)({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
type: 'IMPORTANT',
|
|
164
|
+
content: 'As the edges describe dependencies they point in the inverse order of execution (which is very helpful for backward analyses)! The [visitors](#cfg-working) abstract away from this and there is no harm in considering an inverted CFG. Yet, you should keep this in mind!'
|
|
165
|
+
})}
|
|
175
166
|
|
|
176
167
|
Every normalized node of the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) that has any relevance to the
|
|
177
168
|
execution is added and automatically linked using its id (similarly to vertices of the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph)).
|
|
@@ -202,54 +193,54 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() { 3 }\nf()', { showC
|
|
|
202
193
|
|
|
203
194
|
${(0, doc_structure_1.section)('Structure of the Control Flow Graph', 2, 'cfg-structure')}
|
|
204
195
|
|
|
205
|
-
You can produce your very own control flow graph with ${
|
|
206
|
-
The ${
|
|
207
|
-
${
|
|
208
|
-
However, you should be aware of the ${
|
|
196
|
+
You can produce your very own control flow graph with ${ctx.link(extract_cfg_1.extractCfg)}.
|
|
197
|
+
The ${ctx.link(control_flow_graph_1.ControlFlowGraph)} class describes everything required to model the control flow graph, with its edge types described by
|
|
198
|
+
${ctx.link('CfgEdge')} and its vertices by ${ctx.link('CfgSimpleVertex')}.
|
|
199
|
+
However, you should be aware of the ${ctx.link('ControlFlowInformation')} interface which adds some additional information the CFG
|
|
209
200
|
(and is used during the construction of the CFG as well):
|
|
210
201
|
|
|
211
|
-
${
|
|
202
|
+
${ctx.hierarchy('ControlFlowInformation', { openTop: true })}
|
|
212
203
|
|
|
213
|
-
To check whether the CFG has the expected shape, you can use the test function ${
|
|
214
|
-
sub-graphs as well (it provides diffing capabilities similar to ${
|
|
215
|
-
As the CFG may become unhandy for larger programs, there are simplifications available with ${
|
|
216
|
-
(these can be passed on to the ${
|
|
204
|
+
To check whether the CFG has the expected shape, you can use the test function ${ctx.link('assertCfg')} which supports testing for
|
|
205
|
+
sub-graphs as well (it provides diffing capabilities similar to ${ctx.link('assertDataflow')}).
|
|
206
|
+
As the CFG may become unhandy for larger programs, there are simplifications available with ${ctx.link(cfg_simplification_1.simplifyControlFlowInformation)}
|
|
207
|
+
(these can be passed on to the ${ctx.link(extract_cfg_1.extractCfg)} function as well).
|
|
217
208
|
|
|
218
209
|
${(0, doc_structure_1.section)('CFG Vertices', 3, 'cfg-structure-vertices')}
|
|
219
210
|
|
|
220
|
-
All vertex types are summarized in the ${
|
|
211
|
+
All vertex types are summarized in the ${ctx.link('CfgVertexType')} enum which currently contains the following types:
|
|
221
212
|
|
|
222
213
|
${Object.entries(control_flow_graph_1.CfgVertexType).map(([key, value]) => `- \`${key}\` (${value})`).join('\n')}
|
|
223
214
|
|
|
224
|
-
We use the ${
|
|
225
|
-
expressions (${
|
|
215
|
+
We use the ${ctx.link('CfgBasicBlockVertex')} to represent [basic blocks](#cfg-basic-blocks) and separate
|
|
216
|
+
expressions (${ctx.link('CfgExpressionVertex')}) and statements (${ctx.link('CfgStatementVertex')})
|
|
226
217
|
as control flow units with and without side effects (if you want to, you can see view statements as effectful expressions).
|
|
227
|
-
The markers (${
|
|
218
|
+
The markers (${ctx.link('CfgEndMarkerVertex')}) indicate the end of larger expressions/statements.
|
|
228
219
|
|
|
229
220
|
To signal these links, the expressions and statements contain information about the attached markers:
|
|
230
221
|
|
|
231
|
-
${
|
|
222
|
+
${ctx.hierarchy('CfgWithMarker', { openTop: true })}
|
|
232
223
|
|
|
233
224
|
Similarly, the markers contain a link to their root:
|
|
234
225
|
|
|
235
|
-
${
|
|
226
|
+
${ctx.hierarchy('CfgWithRoot', { openTop: true })}
|
|
236
227
|
|
|
237
228
|
In mermaid visualizations, we use rectangles for statements, rounded rectangles for expressions and circles for exit markers.
|
|
238
229
|
Blocks are visualized as boxes around the contained vertices.
|
|
239
230
|
|
|
240
231
|
${(0, doc_structure_1.block)({
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
Every CFG vertex has a ${
|
|
232
|
+
type: 'NOTE',
|
|
233
|
+
content: `
|
|
234
|
+
Every CFG vertex has a ${ctx.link('NodeId')} that links it to the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) (although basic blocks will find no counterpart as they are a structuring element of the CFG).
|
|
244
235
|
Additionally, it may provide information on the called functions (in case that the current element is a function call).
|
|
245
|
-
Have a look at the ${
|
|
236
|
+
Have a look at the ${ctx.link('CfgBaseVertex')} interface for more information.
|
|
246
237
|
`.trim()
|
|
247
|
-
|
|
238
|
+
})}
|
|
248
239
|
|
|
249
240
|
${(0, doc_structure_1.section)('CFG Edges', 3, 'cfg-structure-edges')}
|
|
250
241
|
|
|
251
|
-
The ${
|
|
252
|
-
and the two interfaces: ${
|
|
242
|
+
The ${ctx.link(control_flow_graph_1.ControlFlowGraph)} uses two types of edges to represent the control flow, separated by the ${ctx.link('CfgEdgeType')} enum
|
|
243
|
+
and the two interfaces: ${ctx.link('CfgFlowDependencyEdge')} and ${ctx.link('CfgControlDependencyEdge')}.
|
|
253
244
|
|
|
254
245
|
${(0, doc_structure_1.section)('Flow Dependencies', 4, 'cfg-flow-dependency')}
|
|
255
246
|
|
|
@@ -263,20 +254,20 @@ ${(0, doc_structure_1.section)('Control Dependencies', 4, 'cfg-control-dependenc
|
|
|
263
254
|
Control dependencies (CD) are used to signal that the execution of the source vertex depends on the taget vertex (which, e.g., is the condition of an \`if\` statement or \`while\` loop).
|
|
264
255
|
They contain additional information to signal _when_ the source vertex is executed:
|
|
265
256
|
|
|
266
|
-
${
|
|
257
|
+
${ctx.hierarchy('CfgControlDependencyEdge', { openTop: true })}
|
|
267
258
|
|
|
268
259
|
The extra \`caused\` link signals the vertex that caused the control flow influence.
|
|
269
260
|
|
|
270
261
|
|
|
271
262
|
${await (async () => {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
263
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart RL\n' });
|
|
264
|
+
return (0, doc_structure_1.details)('Example: if-else', exa);
|
|
265
|
+
})()}
|
|
275
266
|
|
|
276
267
|
${await (async () => {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
268
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart RL\n' });
|
|
269
|
+
return (0, doc_structure_1.details)('Example: while-loop', exa);
|
|
270
|
+
})()}
|
|
280
271
|
<br/>
|
|
281
272
|
|
|
282
273
|
Please note that repeat loops do _not_ have control dependencies, as they repeat their body unconditionally.
|
|
@@ -284,26 +275,26 @@ Additionally, the control flow graph does not have to be connected. If you use a
|
|
|
284
275
|
the corresponding exit markers are not reachable from the entry:
|
|
285
276
|
|
|
286
277
|
${await (async () => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
278
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart RL\n' });
|
|
279
|
+
return (0, doc_structure_1.details)('Example: repeat-loop (infinite)', exa);
|
|
280
|
+
})()}
|
|
290
281
|
|
|
291
282
|
${await (async () => {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
283
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart RL\n' });
|
|
284
|
+
return (0, doc_structure_1.details)('Example: repeat-loop (with break)', exa);
|
|
285
|
+
})()}
|
|
295
286
|
<br/>
|
|
296
287
|
|
|
297
288
|
In the context of a for-loop, the control dependency refer to whether the respective vector still has values to iterate over.
|
|
298
289
|
|
|
299
290
|
${await (async () => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
291
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart RL\n' });
|
|
292
|
+
return (0, doc_structure_1.details)('Example: for-loop', exa);
|
|
293
|
+
})()}
|
|
303
294
|
|
|
304
295
|
${(0, doc_structure_1.section)('Extra: Call Links', 4, 'cfg-call-links')}
|
|
305
296
|
|
|
306
|
-
If you generate the CFG with the ${
|
|
297
|
+
If you generate the CFG with the ${ctx.link(extract_cfg_1.extractCfg)} function you can (and, if you want to gain inter-procedural information, should)
|
|
307
298
|
pass a matching [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) to it to incorporate the dataflow perspective into the CFG.
|
|
308
299
|
|
|
309
300
|
The difference becomes obvious when we look at the code \`f <- function() b; f()\` first without the dataflow graph:
|
|
@@ -318,7 +309,7 @@ There are two important additions:
|
|
|
318
309
|
|
|
319
310
|
1. A new exit marker, canonically suffixed with \`${extract_cfg_1.ResolvedCallSuffix}\` signals that we are aware of the function call target.
|
|
320
311
|
This marker always follows the exit marker of the function call and links not just the call but also the exit points of the function definition.
|
|
321
|
-
2. A new _calls_ attribute attached to the function call vertex. This holds the ${
|
|
312
|
+
2. A new _calls_ attribute attached to the function call vertex. This holds the ${ctx.link('NodeId')} of the function definitions that are called from this vertex.
|
|
322
313
|
|
|
323
314
|
For built-in functions that are provided by flowR's built-in configuration (see the [interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface)) the CFG does not contain
|
|
324
315
|
the additional information directly:
|
|
@@ -334,7 +325,7 @@ ${(0, doc_structure_1.section)('Adding Basic Blocks', 3, 'cfg-basic-blocks')}
|
|
|
334
325
|
As mentioned in the introduction, our control flow graph does not use basic blocks by default and hence simply links all vertices independent of whether they have (un-)conditional jumps or not.
|
|
335
326
|
On the upside, this tells us the execution order (and, in case of promises, forcing order) of involved expressions and seamlessly handles cases like
|
|
336
327
|
\`x <- return(3)\`. On the downside, this makes it hard to apply classical control flow graph algorithms and, in general, makes the graph much harder to read.
|
|
337
|
-
Yet, we can request basic blocks or transform an existing CFG into basic blocks using the ${
|
|
328
|
+
Yet, we can request basic blocks or transform an existing CFG into basic blocks using the ${ctx.link(cfg_to_basic_blocks_1.convertCfgToBasicBlocks)} function.
|
|
338
329
|
|
|
339
330
|
Any program without any (un-)conditional jumps now contains a single basic block:
|
|
340
331
|
|
|
@@ -345,7 +336,7 @@ While the CFG without basic blocks is much bigger:
|
|
|
345
336
|
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n' })}
|
|
346
337
|
|
|
347
338
|
In a way, using the basic blocks perspective does not remove any of these vertices (we just usually visualize them compacted as their execution order should be "obvious").
|
|
348
|
-
The vertices are still there, as elems of the ${
|
|
339
|
+
The vertices are still there, as elems of the ${ctx.link('CfgBasicBlockVertex')}:
|
|
349
340
|
|
|
350
341
|
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: false })}
|
|
351
342
|
|
|
@@ -360,9 +351,9 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, pr
|
|
|
360
351
|
Now, without basic blocks, this is a different story...
|
|
361
352
|
|
|
362
353
|
${await (async () => {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
354
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n' });
|
|
355
|
+
return (0, doc_structure_1.details)('The full CFG', exa);
|
|
356
|
+
})()}
|
|
366
357
|
|
|
367
358
|
And again it should be noted that even though the example code is more complicated, this is still far from the average real-world script.
|
|
368
359
|
|
|
@@ -374,35 +365,35 @@ Similarly, flowR provides you with a set of utility functions and classes that y
|
|
|
374
365
|
${(0, doc_structure_1.section)('Simple Traversal', 3, 'cfg-simple-traversal')}
|
|
375
366
|
|
|
376
367
|
If you are just interested in traversing the vertices within the cfg, two simple functions
|
|
377
|
-
${
|
|
368
|
+
${ctx.link(simple_visitor_1.visitCfgInOrder)} and ${ctx.link(simple_visitor_1.visitCfgInReverseOrder)} are available. For [basic blocks](#cfg-basic-blocks)
|
|
378
369
|
these will automatically traverse the elements contained within the blocks (in the respective order).
|
|
379
370
|
For example, the following function will return all numbers contained within the CFG:
|
|
380
371
|
|
|
381
|
-
${
|
|
372
|
+
${ctx.code(sampleCollectNumbers)}
|
|
382
373
|
|
|
383
374
|
Calling it with the CFG and AST of the expression \`x - 1 + 2L * 3\` yields the following elements (in this order):
|
|
384
375
|
|
|
385
376
|
${await (async () => {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
377
|
+
const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
|
|
378
|
+
const collected = sampleCollectNumbers(res.info, res.ast);
|
|
379
|
+
return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
|
|
380
|
+
})()}
|
|
390
381
|
|
|
391
|
-
A more useful appearance of these visitors occurs with ${
|
|
382
|
+
A more useful appearance of these visitors occurs with ${ctx.link(happens_before_1.happensBefore)} which uses the CFG to determine whether the execution
|
|
392
383
|
of one vertex always, maybe, or never happens before another vertex (see the corresponding [query documentation](${doc_files_1.FlowrWikiBaseRef}/Query-API#happens-before-query) for more information).
|
|
393
384
|
|
|
394
385
|
|
|
395
386
|
${(0, doc_structure_1.section)('Diffing and Testing', 3, 'cfg-diff-and-test')}
|
|
396
387
|
|
|
397
|
-
As mentioned above, you can use the test function ${
|
|
398
|
-
The function supports testing for sub-graphs as well (it provides diffing capabilities similar to ${
|
|
399
|
-
If you want to diff two control flow graphs, you can use the ${
|
|
388
|
+
As mentioned above, you can use the test function ${ctx.link('assertCfg')} to check whether the control flow graph has the desired shape.
|
|
389
|
+
The function supports testing for sub-graphs as well (it provides diffing capabilities similar to ${ctx.link('assertDataflow')}).
|
|
390
|
+
If you want to diff two control flow graphs, you can use the ${ctx.link(diff_cfg_1.diffOfControlFlowGraphs)} function.
|
|
400
391
|
|
|
401
392
|
${(0, doc_structure_1.section)('Checking Properties', 4, 'cfg-check-properties')}
|
|
402
393
|
|
|
403
394
|
To be a valid representation of the program, the CFG should satisfy a collection of properties that, in turn, you can automatically assume to hold
|
|
404
|
-
when working with it. In general, we verify these in every unit test using ${
|
|
405
|
-
and you can have a look at the active properties by checking the ${
|
|
395
|
+
when working with it. In general, we verify these in every unit test using ${ctx.link(cfg_properties_1.assertCfgSatisfiesProperties)},
|
|
396
|
+
and you can have a look at the active properties by checking the ${ctx.link('CfgProperties')} object.
|
|
406
397
|
In general, we check for a hammock graph (given that the program contains no definite infinite loop) and the absence of direct cycles.
|
|
407
398
|
|
|
408
399
|
${(0, doc_structure_1.section)('Sophisticated CFG Traversal', 3, 'cfg-traversal')}
|
|
@@ -422,97 +413,97 @@ visitors that incorporate various alternative perspectives:
|
|
|
422
413
|
|
|
423
414
|
${(0, doc_structure_1.section)('Basic CFG Visitor', 4, 'cfg-traversal-basic')}
|
|
424
415
|
|
|
425
|
-
The ${
|
|
416
|
+
The ${ctx.link(basic_cfg_guided_visitor_1.BasicCfgGuidedVisitor)} class essential provides the same functionality as the [simple traversal](#cfg-simple-traversal) functions but in a class-based version.
|
|
426
417
|
Using it, you can select whether you want to traverse the CFG in order or in reverse order.
|
|
427
418
|
|
|
428
419
|
To replicate the number collector from above, you can use the following code:
|
|
429
420
|
|
|
430
|
-
${
|
|
421
|
+
${ctx.code(CollectNumbersVisitor)}
|
|
431
422
|
|
|
432
|
-
Instead of directly calling ${
|
|
423
|
+
Instead of directly calling ${ctx.link(simple_visitor_1.visitCfgInOrder)} we pass the \`forward\` visiting order to the constructor of the visitor.
|
|
433
424
|
Executing it with the CFG and AST of the expression \`x - 1 + 2L * 3\`, causes the following numbers to be collected:
|
|
434
425
|
|
|
435
426
|
${await (async () => {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
427
|
+
const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
|
|
428
|
+
const visitor = new CollectNumbersVisitor(res.info, res.ast);
|
|
429
|
+
visitor.start();
|
|
430
|
+
const collected = visitor.getNumbers();
|
|
431
|
+
return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
|
|
432
|
+
})()}
|
|
442
433
|
|
|
443
434
|
|
|
444
435
|
${(0, doc_structure_1.section)('Syntax-Aware CFG Visitor', 4, 'cfg-traversal-syntax')}
|
|
445
436
|
|
|
446
|
-
The ${
|
|
437
|
+
The ${ctx.link(syntax_cfg_guided_visitor_1.SyntaxAwareCfgGuidedVisitor)} class incorporates knowledge of the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) into the CFG traversal and
|
|
447
438
|
directly provides specialized visitors for the various node types.
|
|
448
439
|
Now, our running example of collecting all numbers simplifies to this:
|
|
449
440
|
|
|
450
|
-
${
|
|
441
|
+
${ctx.code(CollectNumbersSyntaxVisitor)}
|
|
451
442
|
|
|
452
443
|
And again, executing it with the CFG and AST of the expression \`x - 1 + 2L * 3\`, causes the following numbers to be collected:
|
|
453
444
|
|
|
454
445
|
${await (async () => {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
446
|
+
const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
|
|
447
|
+
const visitor = new CollectNumbersSyntaxVisitor(res.info, res.ast);
|
|
448
|
+
visitor.start();
|
|
449
|
+
const collected = visitor.getNumbers();
|
|
450
|
+
return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
|
|
451
|
+
})()}
|
|
461
452
|
|
|
462
453
|
${(0, doc_structure_1.section)('Dataflow-Aware CFG Visitor', 4, 'cfg-traversal-dfg')}
|
|
463
454
|
|
|
464
455
|
There is a lot of benefit in incorporating the [dataflow information](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) into the CFG traversal, as it contains
|
|
465
456
|
information about overwritten function calls, definition targets, and so on.
|
|
466
|
-
Our best friend is the ${
|
|
467
|
-
The ${
|
|
457
|
+
Our best friend is the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} function which provides the important information about the origin of a vertex in the dataflow graph.
|
|
458
|
+
The ${ctx.link(dfg_cfg_guided_visitor_1.DataflowAwareCfgGuidedVisitor)} class does some of the basic lifting for us.
|
|
468
459
|
While it is not ideal for our goal of collecting all numbers, it shines in other areas such as collecting all used variables, ...
|
|
469
460
|
|
|
470
|
-
${
|
|
461
|
+
${ctx.code(CollectNumbersDataflowVisitor)}
|
|
471
462
|
|
|
472
463
|
Again, executing it with the CFG and Dataflow of the expression \`x - 1 + 2L * 3\`, causes the following numbers to be collected:
|
|
473
464
|
|
|
474
465
|
${await (async () => {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
466
|
+
const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
|
|
467
|
+
const visitor = new CollectNumbersDataflowVisitor(res.info, res.dataflow.graph);
|
|
468
|
+
visitor.start();
|
|
469
|
+
const collected = visitor.getNumbers();
|
|
470
|
+
return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
|
|
471
|
+
})()}
|
|
481
472
|
|
|
482
473
|
${(0, doc_structure_1.section)('Semantic CFG Visitor', 4, 'cfg-traversal-semantic')}
|
|
483
474
|
|
|
484
|
-
The ${
|
|
475
|
+
The ${ctx.link(semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor)} class is flowR's most advanced visitor that combines the syntactic and dataflow information.
|
|
485
476
|
The main idea is simple, it provides special handlers for assignments, conditionals, and other R semantics but still follows
|
|
486
477
|
the structure of the CFG.
|
|
487
478
|
|
|
488
479
|
${(0, doc_structure_1.block)({
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
480
|
+
type: 'NOTE',
|
|
481
|
+
content: `This visitor is still in the design phase so please open up a [new issue](${doc_issue_1.NewIssueUrl}) if you have any suggestions or find any bugs.`
|
|
482
|
+
})}
|
|
492
483
|
|
|
493
484
|
To explore what it is capable of, let's create a visitor that prints all values that are used in assignments:
|
|
494
485
|
|
|
495
|
-
${
|
|
486
|
+
${ctx.code(CollectSourcesSemanticVisitor)}
|
|
496
487
|
|
|
497
488
|
Executing it with the CFG and Dataflow of the expression \`x <- 2; 3 -> x; assign("x", 42 + 21)\`, causes the following values (/lexemes) to be collected:
|
|
498
489
|
|
|
499
490
|
${await (async () => {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
491
|
+
const res = await (0, doc_cfg_1.getCfg)(shell, 'x <- 2; 3 -> x; assign("x", 42 + 21)');
|
|
492
|
+
const visitor = new CollectSourcesSemanticVisitor(res.info, res.ast, res.dataflow.graph, (0, flowr_analyzer_context_1.contextFromInput)(''));
|
|
493
|
+
visitor.start();
|
|
494
|
+
const collected = visitor.getSources();
|
|
495
|
+
return collected.map(n => '\n- `' + n + '`').join('');
|
|
496
|
+
})()}
|
|
506
497
|
|
|
507
498
|
All in all, this visitor offers the following semantic events:
|
|
508
499
|
|
|
509
500
|
${
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
501
|
+
/* let's iterate over all methods */
|
|
502
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(new semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor(undefined)))
|
|
503
|
+
.filter(n => n !== 'constructor').sort().map(key => {
|
|
504
|
+
const doc = (0, doc_general_1.prefixLines)(ctx.doc(`SemanticCfgGuidedVisitor::${key}`), ' ');
|
|
505
|
+
return `- ${ctx.link(`SemanticCfgGuidedVisitor::${key}`)}\\\n${doc ?? '_no documentation available_'}\n`;
|
|
506
|
+
}).join('\n')}
|
|
516
507
|
|
|
517
508
|
|
|
518
509
|
${(0, doc_structure_1.section)('Working With Exit Points', 3, 'cfg-exit-points')}
|
|
@@ -522,49 +513,42 @@ With the [Dataflow Graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) you
|
|
|
522
513
|
But the control flow perspective gives you more! Given a simple addition like \`x + 1\`, the CFG looks like this:
|
|
523
514
|
|
|
524
515
|
${await (async function () {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
516
|
+
const cfg = await (0, doc_cfg_1.getCfg)(shell, 'x + 1');
|
|
517
|
+
const [plusVertexId, plusVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === '+')[0];
|
|
518
|
+
(0, assert_1.guard)(plusVertex.type === control_flow_graph_1.CfgVertexType.Expression);
|
|
519
|
+
const numOfExits = plusVertex.end?.length ?? 0;
|
|
520
|
+
(0, assert_1.guard)(plusVertex.end && numOfExits === 1);
|
|
521
|
+
return `${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart RL\n' })}
|
|
531
522
|
|
|
532
523
|
Looking at the binary operation vertex for \`+\` (with id \`${plusVertexId}\`) we see that it is linked to a single exit ("end marker") point: \`${plusVertex.end[0]}\`.
|
|
533
524
|
Checking this vertex essentially reveals all exit points of the expression ‐ in this case, this simply refers to the operands of the addition.
|
|
534
525
|
However, the idea transfers to more complex expressions as well...
|
|
535
526
|
`;
|
|
536
|
-
|
|
527
|
+
})()}
|
|
537
528
|
|
|
538
529
|
${(0, doc_structure_1.details)('Example: Exit Points for an if', await (async function () {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
530
|
+
const expr = 'if(u) 3 else 2';
|
|
531
|
+
const cfg = await (0, doc_cfg_1.getCfg)(shell, expr);
|
|
532
|
+
const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === 'if')[0];
|
|
533
|
+
(0, assert_1.guard)(ifVertex.type === control_flow_graph_1.CfgVertexType.Statement);
|
|
534
|
+
const numOfExits = ifVertex.end?.length ?? 0;
|
|
535
|
+
(0, assert_1.guard)(ifVertex.end && numOfExits === 1);
|
|
536
|
+
return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart RL\n' })}
|
|
546
537
|
|
|
547
538
|
Looking at the if vertex for (with id \`${ifVertexId}\`) we see that it is again linked to a single exit point: \`${ifVertex.end[0]}\`.
|
|
548
539
|
Yet, now this exit vertex is linked to the two branches of the if statement (the \`then\` and \`else\` branch).
|
|
549
540
|
`;
|
|
550
|
-
|
|
541
|
+
})())}
|
|
551
542
|
|
|
552
543
|
Hence, you may rely on the corresponding exit point(s) to identify all exits of a given expression (in a way, these exit-points are merely super-sinks trying to ensure the hammock graph property).
|
|
553
544
|
|
|
554
545
|
${(0, doc_structure_1.block)({
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
546
|
+
type: 'WARNING',
|
|
547
|
+
content: 'Using basic blocks, this works just the same. However, please keep in mind that the corresponding exit markers do not (and for control statements usually will not) be part of the same basic block.'
|
|
548
|
+
})}
|
|
558
549
|
|
|
559
550
|
`;
|
|
551
|
+
}
|
|
560
552
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
const shell = new shell_1.RShell();
|
|
564
|
-
void getText(shell).then(str => {
|
|
565
|
-
console.log(str);
|
|
566
|
-
}).finally(() => {
|
|
567
|
-
shell.close();
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
//# sourceMappingURL=print-cfg-wiki.js.map
|
|
553
|
+
exports.WikiCfg = WikiCfg;
|
|
554
|
+
//# sourceMappingURL=wiki-cfg.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlowrAnalyzer } from '../project/flowr-analyzer';
|
|
2
|
+
import type { DocMakerArgs } from './wiki-mk/doc-maker';
|
|
3
|
+
import { DocMaker } from './wiki-mk/doc-maker';
|
|
4
|
+
/**
|
|
5
|
+
* Shows how to inspect the context of an analyzer instance.
|
|
6
|
+
*/
|
|
7
|
+
export declare function inspectContextExample(analyzer: FlowrAnalyzer): void;
|
|
8
|
+
/**
|
|
9
|
+
* https://github.com/flowr-analysis/flowr/wiki/Core
|
|
10
|
+
*/
|
|
11
|
+
export declare class WikiCore extends DocMaker {
|
|
12
|
+
constructor();
|
|
13
|
+
text({ shell, treeSitter, ctx }: DocMakerArgs): Promise<string>;
|
|
14
|
+
}
|