@eagleoutice/flowr 2.14.1 → 2.14.2

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.
Files changed (413) hide show
  1. package/README.md +154 -87
  2. package/abstract-interpretation/absint-visitor.d.ts +91 -25
  3. package/abstract-interpretation/absint-visitor.js +235 -74
  4. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +1 -1
  5. package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
  6. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
  7. package/abstract-interpretation/data-frame/mappers/arguments.js +1 -1
  8. package/abstract-interpretation/data-frame/mappers/function-mapper.js +107 -254
  9. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -5
  10. package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
  11. package/abstract-interpretation/data-frame/resolve-args.js +6 -4
  12. package/abstract-interpretation/data-frame/shape-inference.d.ts +4 -9
  13. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -0
  14. package/abstract-interpretation/domains/bounded-set-domain.js +1 -0
  15. package/abstract-interpretation/domains/partial-product-domain.js +1 -1
  16. package/abstract-interpretation/domains/set-range-domain.d.ts +3 -2
  17. package/abstract-interpretation/domains/set-range-domain.js +3 -2
  18. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +3 -2
  19. package/abstract-interpretation/domains/set-upper-bound-domain.js +3 -2
  20. package/benchmark/calibration.d.ts +11 -6
  21. package/benchmark/calibration.js +19 -8
  22. package/benchmark/slicer.d.ts +7 -1
  23. package/benchmark/slicer.js +38 -34
  24. package/benchmark/stats/count-comments.d.ts +16 -0
  25. package/benchmark/stats/count-comments.js +30 -0
  26. package/benchmark/stats/print.js +2 -0
  27. package/benchmark/stats/size-of.d.ts +7 -3
  28. package/benchmark/stats/size-of.js +7 -3
  29. package/benchmark/stats/stats.d.ts +7 -0
  30. package/benchmark/summarizer/first-phase/process.js +2 -19
  31. package/benchmark/summarizer/second-phase/graph.js +13 -3
  32. package/benchmark/summarizer/second-phase/process.js +2 -0
  33. package/cli/repl/commands/repl-dataflow.js +70 -27
  34. package/cli/repl/core.d.ts +1 -1
  35. package/cli/repl/core.js +1 -1
  36. package/cli/repl/parser/slice-query-parser.js +2 -1
  37. package/cli/repl/server/connection.d.ts +4 -0
  38. package/cli/repl/server/connection.js +19 -16
  39. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  40. package/config.d.ts +6 -0
  41. package/config.js +8 -4
  42. package/control-flow/basic-cfg-guided-visitor.d.ts +7 -2
  43. package/control-flow/basic-cfg-guided-visitor.js +37 -24
  44. package/control-flow/cfg-dead-code.js +44 -33
  45. package/control-flow/cfg-properties.js +2 -2
  46. package/control-flow/cfg-simplification.js +6 -5
  47. package/control-flow/cfg-to-basic-blocks.js +11 -13
  48. package/control-flow/control-flow-graph.d.ts +179 -189
  49. package/control-flow/control-flow-graph.js +400 -263
  50. package/control-flow/dfg-cfg-guided-visitor.d.ts +21 -3
  51. package/control-flow/dfg-cfg-guided-visitor.js +17 -13
  52. package/control-flow/diff-cfg.js +6 -14
  53. package/control-flow/happens-before.js +5 -4
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +44 -101
  55. package/control-flow/semantic-cfg-guided-visitor.js +6 -26
  56. package/control-flow/simple-visitor.js +14 -15
  57. package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -1
  58. package/control-flow/useless-loop.js +18 -14
  59. package/core/steps/all/core/20-dataflow.d.ts +1 -3
  60. package/core/steps/pipeline/default-pipelines.d.ts +141 -157
  61. package/dataflow/cluster.js +7 -0
  62. package/dataflow/environments/apply-kill.d.ts +6 -0
  63. package/dataflow/environments/apply-kill.js +63 -31
  64. package/dataflow/environments/built-in-props.d.ts +5 -1
  65. package/dataflow/environments/built-in-props.js +4 -0
  66. package/dataflow/environments/built-in.d.ts +6 -3
  67. package/dataflow/environments/built-in.js +8 -5
  68. package/dataflow/environments/clone.d.ts +3 -3
  69. package/dataflow/environments/clone.js +5 -5
  70. package/dataflow/environments/default-builtin-config.d.ts +112 -7
  71. package/dataflow/environments/default-builtin-config.js +82 -34
  72. package/dataflow/environments/environment.d.ts +5 -5
  73. package/dataflow/environments/environment.js +5 -5
  74. package/dataflow/environments/identifier.d.ts +11 -1
  75. package/dataflow/environments/identifier.js +4 -1
  76. package/dataflow/environments/resolve-by-name.d.ts +7 -0
  77. package/dataflow/environments/resolve-by-name.js +12 -0
  78. package/dataflow/environments/resolve-helper.d.ts +3 -1
  79. package/dataflow/environments/resolve-helper.js +2 -0
  80. package/dataflow/eval/resolve/alias-tracking.d.ts +2 -2
  81. package/dataflow/eval/resolve/alias-tracking.js +2 -2
  82. package/dataflow/eval/resolve/match-arguments.js +7 -5
  83. package/dataflow/eval/resolve/node-value.d.ts +3 -1
  84. package/dataflow/eval/resolve/node-value.js +12 -0
  85. package/dataflow/eval/resolve/resolve-argument.js +5 -4
  86. package/dataflow/eval/resolve/resolve-operators.js +9 -6
  87. package/dataflow/eval/resolve/resolve-strings.js +2 -2
  88. package/dataflow/eval/resolve/resolve-working-directory.js +4 -3
  89. package/dataflow/eval/resolve/resolve.js +3 -2
  90. package/dataflow/eval/values/general.js +8 -5
  91. package/dataflow/extractor.d.ts +1 -4
  92. package/dataflow/extractor.js +11 -10
  93. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  94. package/dataflow/fn/strict-function.js +7 -5
  95. package/dataflow/graph/call-graph.js +2 -2
  96. package/dataflow/graph/df-helper.d.ts +8 -1
  97. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  98. package/dataflow/graph/diff-dataflow-graph.js +19 -2
  99. package/dataflow/graph/edge.d.ts +38 -2
  100. package/dataflow/graph/edge.js +32 -2
  101. package/dataflow/graph/graph.d.ts +4 -3
  102. package/dataflow/graph/graph.js +6 -2
  103. package/dataflow/graph/match-args.d.ts +69 -0
  104. package/dataflow/graph/match-args.js +167 -0
  105. package/dataflow/info.d.ts +14 -0
  106. package/dataflow/internal/control-flow.d.ts +102 -0
  107. package/dataflow/internal/control-flow.js +200 -0
  108. package/dataflow/internal/linker.d.ts +6 -31
  109. package/dataflow/internal/linker.js +24 -81
  110. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  111. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -2
  113. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -6
  114. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  115. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +6 -4
  116. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -10
  117. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -37
  118. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -3
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +1 -1
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +11 -7
  122. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  123. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  124. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +18 -14
  125. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +8 -1
  126. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -0
  127. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
  128. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +27 -20
  129. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -2
  130. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
  131. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +35 -6
  132. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
  133. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +20 -17
  134. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +1 -1
  135. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +6 -4
  136. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +4 -3
  137. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +8 -3
  138. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +2 -2
  139. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +5 -5
  140. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
  141. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +5 -4
  142. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +7 -5
  143. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +1 -1
  144. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +15 -13
  145. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
  146. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +4 -3
  148. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +1 -1
  149. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +26 -4
  150. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
  151. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +17 -4
  152. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
  153. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +71 -33
  154. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +6 -15
  155. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +12 -13
  156. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  157. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +14 -11
  158. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +15 -1
  159. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  160. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +12 -8
  161. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -5
  162. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +1 -1
  163. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +5 -4
  164. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
  165. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +45 -10
  166. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
  167. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +19 -3
  168. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +6 -2
  169. package/dataflow/internal/process/functions/call/common.js +5 -6
  170. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  171. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +12 -2
  172. package/dataflow/internal/process/functions/call/known-call-handling.js +23 -1
  173. package/dataflow/internal/process/functions/call/named-call-handling.js +2 -0
  174. package/dataflow/internal/process/functions/call/nse.d.ts +1 -1
  175. package/dataflow/internal/process/functions/call/nse.js +6 -1
  176. package/dataflow/internal/process/functions/call/quoted.js +2 -2
  177. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +19 -6
  178. package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
  179. package/dataflow/internal/process/functions/process-argument.js +12 -4
  180. package/dataflow/internal/process/functions/process-parameter.js +13 -0
  181. package/dataflow/internal/process/process-named-call.d.ts +2 -2
  182. package/dataflow/internal/process/process-named-call.js +9 -7
  183. package/documentation/data/server/doc-data-server-messages.js +4 -4
  184. package/documentation/doc-readme.js +45 -0
  185. package/documentation/doc-util/doc-cfg.d.ts +8 -7
  186. package/documentation/doc-util/doc-cfg.js +10 -10
  187. package/documentation/doc-util/doc-playground.d.ts +12 -0
  188. package/documentation/doc-util/doc-playground.js +21 -0
  189. package/documentation/doc-util/doc-query.d.ts +4 -1
  190. package/documentation/doc-util/doc-query.js +4 -2
  191. package/documentation/wiki-absint.d.ts +3 -4
  192. package/documentation/wiki-absint.js +12 -5
  193. package/documentation/wiki-analyzer.js +2 -2
  194. package/documentation/wiki-cfg.js +101 -106
  195. package/documentation/wiki-dataflow-graph.js +84 -53
  196. package/documentation/wiki-linter.js +15 -1
  197. package/documentation/wiki-linting-and-testing.js +1 -16
  198. package/documentation/wiki-mk/doc-maker.js +6 -4
  199. package/documentation/wiki-query.js +14 -4
  200. package/documentation/wiki-signature-database.js +28 -2
  201. package/linter/linter-fix.d.ts +16 -0
  202. package/linter/linter-fix.js +104 -0
  203. package/linter/linter-format.d.ts +18 -1
  204. package/linter/linter-format.js +31 -1
  205. package/linter/linter-output.js +46 -10
  206. package/linter/linter-rules.d.ts +40 -9
  207. package/linter/linter-rules.js +2 -0
  208. package/linter/rules/absolute-path.js +4 -2
  209. package/linter/rules/dataframe-access-validation.js +6 -7
  210. package/linter/rules/deprecated-functions.d.ts +107 -10
  211. package/linter/rules/deprecated-functions.js +309 -23
  212. package/linter/rules/file-path-validity.js +5 -4
  213. package/linter/rules/function-finder-util.d.ts +6 -0
  214. package/linter/rules/function-finder-util.js +21 -13
  215. package/linter/rules/naming-convention.js +1 -1
  216. package/linter/rules/network-functions.d.ts +2 -2
  217. package/linter/rules/stop-with-call-arg.js +2 -2
  218. package/linter/rules/unclosed-connection.js +2 -2
  219. package/linter/rules/undefined-symbol-util.js +6 -4
  220. package/linter/rules/undefined-symbol.js +2 -2
  221. package/linter/rules/unused-definition.js +8 -4
  222. package/linter/rules/unused-import.d.ts +60 -0
  223. package/linter/rules/unused-import.js +179 -0
  224. package/package.json +2 -2
  225. package/project/attached-packages.js +2 -1
  226. package/project/cache/flowr-analyzer-cache.d.ts +2 -5
  227. package/project/cache/flowr-analyzer-cache.js +4 -7
  228. package/project/cache/flowr-analyzer-controlflow-cache.d.ts +9 -8
  229. package/project/cache/flowr-analyzer-controlflow-cache.js +17 -34
  230. package/project/cache/flowr-cache.d.ts +9 -0
  231. package/project/cache/flowr-cache.js +19 -0
  232. package/project/context/flowr-analyzer-context.d.ts +7 -3
  233. package/project/context/flowr-analyzer-context.js +15 -9
  234. package/project/context/flowr-analyzer-dependencies-context.d.ts +24 -3
  235. package/project/context/flowr-analyzer-dependencies-context.js +9 -14
  236. package/project/context/flowr-analyzer-files-context.js +15 -17
  237. package/project/context/flowr-analyzer-meta-context.js +2 -12
  238. package/project/dependency-version-space.d.ts +0 -7
  239. package/project/dependency-version-space.js +8 -7
  240. package/project/flowr-analyzer.d.ts +4 -6
  241. package/project/flowr-analyzer.js +4 -5
  242. package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -34
  243. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +13 -13
  244. package/project/plugins/file-plugins/files/flowr-rda-file.js +131 -286
  245. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +1 -0
  246. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -0
  247. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +2 -5
  248. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +2 -8
  249. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +32 -0
  250. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +43 -1
  251. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +4 -12
  252. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +3 -16
  253. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +5 -8
  254. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +4 -10
  255. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +3 -10
  256. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +1 -13
  257. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +3 -6
  258. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -8
  259. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +2 -5
  260. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +2 -8
  261. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +2 -5
  262. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +2 -8
  263. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +3 -4
  264. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -6
  265. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +4 -12
  266. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +3 -16
  267. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +4 -12
  268. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +3 -16
  269. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +4 -12
  270. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -16
  271. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +2 -5
  272. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +2 -8
  273. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +2 -6
  274. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +1 -10
  275. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +2 -5
  276. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.js +2 -8
  277. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +2 -1
  278. package/project/sigdb/build.d.ts +2 -2
  279. package/project/sigdb/decode.d.ts +0 -5
  280. package/project/sigdb/decode.js +0 -8
  281. package/project/sigdb/index-format.d.ts +4 -4
  282. package/project/sigdb/manifest.d.ts +2 -2
  283. package/project/sigdb/reader.d.ts +48 -13
  284. package/project/sigdb/reader.js +2 -1
  285. package/project/sigdb/schema.d.ts +3 -1
  286. package/project/sigdb/signature-db.d.ts +69 -0
  287. package/project/sigdb/signature-db.js +54 -0
  288. package/project/sigdb/signature-match.d.ts +10 -5
  289. package/project/sigdb/signature-match.js +13 -8
  290. package/queries/catalog/absint-query/absint-query-executor.js +1 -2
  291. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -4
  292. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
  293. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +33 -6
  294. package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -2
  295. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  296. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +8 -7
  297. package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -35
  298. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +13 -1
  299. package/queries/catalog/dependencies-query/function-info/library-functions.js +26 -22
  300. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +9 -0
  301. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +19 -0
  302. package/queries/catalog/dependencies-query/implicit-echo.d.ts +13 -0
  303. package/queries/catalog/dependencies-query/implicit-echo.js +133 -0
  304. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  305. package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -2
  306. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  307. package/queries/catalog/signature-query/signature-query-executor.js +4 -3
  308. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  309. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  310. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  311. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  312. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  313. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -1
  314. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -2
  315. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  316. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  317. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  318. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  319. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  320. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  321. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  322. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  323. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  324. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  325. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
  326. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +6 -4
  327. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  328. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  329. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  330. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +6 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +13 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  355. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  356. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  357. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +3 -2
  358. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.js +2 -1
  359. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +2 -1
  360. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  361. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -1
  362. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +2 -2
  363. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +6 -3
  364. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -1
  365. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -1
  366. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -3
  367. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +2 -1
  368. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -1
  369. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  370. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +5 -3
  371. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -1
  372. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +1 -1
  373. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -1
  374. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -1
  375. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +1 -1
  376. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -1
  377. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +5 -3
  378. package/reconstruct/inline/source-inline-map.js +3 -3
  379. package/reconstruct/reconstruct.js +6 -4
  380. package/search/flowr-search-builder.d.ts +8 -8
  381. package/search/flowr-search-builder.js +4 -4
  382. package/search/flowr-search-filters.d.ts +2 -2
  383. package/search/flowr-search-filters.js +3 -2
  384. package/search/search-executor/search-enrichers.d.ts +6 -4
  385. package/search/search-executor/search-enrichers.js +44 -5
  386. package/slicing/criterion/filters/all-variables.js +2 -1
  387. package/slicing/criterion/parse.js +8 -6
  388. package/slicing/static/slice-call.js +2 -2
  389. package/util/arg-matching.d.ts +3 -0
  390. package/util/arg-matching.js +12 -1
  391. package/util/collections/arrays.d.ts +0 -4
  392. package/util/collections/arrays.js +4 -26
  393. package/util/diff-graph.d.ts +1 -1
  394. package/util/diff-graph.js +17 -3
  395. package/util/diff.d.ts +6 -0
  396. package/util/mermaid/ast.d.ts +1 -1
  397. package/util/mermaid/ast.js +5 -4
  398. package/util/mermaid/cfg.js +130 -24
  399. package/util/mermaid/dfg.js +31 -10
  400. package/util/mermaid/mermaid.js +2 -0
  401. package/util/objects.d.ts +9 -0
  402. package/util/objects.js +12 -0
  403. package/util/prefix.d.ts +1 -1
  404. package/util/text/playground-link.d.ts +131 -0
  405. package/util/text/playground-link.js +214 -0
  406. package/util/text/strings.js +7 -3
  407. package/util/version.js +1 -1
  408. package/control-flow/cfg-builder.d.ts +0 -30
  409. package/control-flow/cfg-builder.js +0 -79
  410. package/control-flow/extract-cfg.d.ts +0 -36
  411. package/control-flow/extract-cfg.js +0 -693
  412. package/project/cfg-kind.d.ts +0 -21
  413. package/project/cfg-kind.js +0 -26
@@ -8,10 +8,10 @@ const interval_domain_1 = require("../abstract-interpretation/domains/interval-d
8
8
  const lattice_1 = require("../abstract-interpretation/domains/lattice");
9
9
  const multi_value_state_domain_1 = require("../abstract-interpretation/domains/multi-value-state-domain");
10
10
  const state_abstract_domain_1 = require("../abstract-interpretation/domains/state-abstract-domain");
11
+ const basic_cfg_guided_visitor_1 = require("../control-flow/basic-cfg-guided-visitor");
11
12
  const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guided-visitor");
12
13
  const identifier_1 = require("../dataflow/environments/identifier");
13
14
  const graph_1 = require("../dataflow/graph/graph");
14
- const cfg_kind_1 = require("../project/cfg-kind");
15
15
  const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
16
16
  const doc_code_1 = require("./doc-util/doc-code");
17
17
  const doc_files_1 = require("./doc-util/doc-files");
@@ -57,7 +57,7 @@ async function inferIntervals() {
57
57
  `.trim());
58
58
  const ast = await analyzer.normalize();
59
59
  const dfg = (await analyzer.dataflow()).graph;
60
- const cfg = await analyzer.controlflow(undefined, cfg_kind_1.CfgKind.NoFunctionDefs);
60
+ const cfg = await analyzer.controlflow(undefined);
61
61
  const ctx = analyzer.inspectContext();
62
62
  const inference = new IntervalInferenceVisitor({ controlFlow: cfg, dfg: dfg, normalizedAst: ast, ctx: ctx });
63
63
  inference.start();
@@ -121,7 +121,7 @@ All boxes link to their respective implementation in the source code.
121
121
  ${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid(abstract_domain_1.AbstractDomain))}
122
122
  `.trim())}
123
123
 
124
- The ${ctx.link('Top')} and ${ctx.link('Bottom')} symbols can be used to explicitly represent the top or bottom elment of an abstract domain. Additionally, for value abstract domains, there is the ${ctx.link('SatisfiableDomain')} interface that provides the function ${ctx.link('SatisfiableDomain:::satisfies')} to check whether the current abstract value of the abstract domain satisfies a concrete value (see also ${ctx.link('NumericalComparator')} and ${ctx.link('SetComparator')}).
124
+ The ${ctx.link('Top')} and ${ctx.link('Bottom')} symbols can be used to explicitly represent the top or bottom elment of an abstract domain. Additionally, for value abstract domains, there is the ${ctx.link('ValueDomain')} interface that provides the function ${ctx.link('ValueDomain:::satisfies')} to check whether the current abstract value of the abstract domain satisfies a concrete value (see also ${ctx.link('NumericalComparator')} and ${ctx.link('SetComparator')}).
125
125
 
126
126
  _flowR_ already provides different abstract domains for abstract interpretation in ${(0, doc_files_1.linkFlowRSourceFile)('src/abstract-interpretation/domains')}. Many of the abstract domains are generic and can be used for differend kinds of analyses. The existing abstract domains are presented in the following. Some of the listed abstract domains can be expanded to show the inherited abstract domains.
127
127
 
@@ -138,7 +138,14 @@ ${ctx.code(multiValueExample, { dropLinesStart: 1, dropLinesEnd: 1, hideDefinedA
138
138
 
139
139
  ${(0, doc_structure_1.section)('Abstract Interpretation', 2, 'abstract-interpretation')}
140
140
 
141
- We perform abstract interpretation by forward-traversing the ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')} of _flowR_ using an ${ctx.link(absint_visitor_1.AbstractInterpretationVisitor)}. For each visited control flow vertex, the visitor retrieves the current abstract state by joining the abstract states of the predecessors, applies the abstract semantics of the visited control flow vertex to the current state, and updates the abstract state of the currently visited vertex to the current state. The visitor already handles assignments and (delayed) widening at widening points. However, the visitor does not yet support interprocedural abstract interpretation.
141
+ We perform abstract interpretation by forward-traversing the ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')} of _flowR_ using an ${ctx.link(absint_visitor_1.AbstractInterpretationVisitor)}. For each visited control flow vertex, the visitor retrieves the current abstract state by joining the abstract states of the predecessors, applies the abstract semantics of the visited control flow vertex to the current state, and updates the abstract state of the currently visited vertex to the current state. The visitor already handles assignments and (delayed) widening at widening points.
142
+
143
+ Joining the predecessors goes through ${ctx.link(`${absint_visitor_1.AbstractInterpretationVisitor.name}::getPredecessorState`)}, which is handed the branch that was taken to get to the vertex.
144
+ For \`if(u) 3 else 2\` the step onto \`3\` reports the condition \`u\` as the predecessor and the \`if\` as the branch, together with the outcome \`u\` had, so an analysis can pin the condition down on the way into a branch.
145
+ The other direction is ${ctx.link(`${basic_cfg_guided_visitor_1.BasicCfgGuidedVisitor.name}::getDecidedConstructs`)}: standing on \`u\`, it names the \`if\` that \`u\` decides.
146
+
147
+ Calls are not followed by default. Overriding ${ctx.link(`${absint_visitor_1.AbstractInterpretationVisitor.name}::shouldEnterCall`)} makes the visitor step into what a call dispatches to and continue with the state at the exit points of those functions, using ${ctx.link(`${absint_visitor_1.AbstractInterpretationVisitor.name}::enterCall`)}.
148
+ A function that is already being interpreted is not entered again, so a recursive call stops at the second entry.
142
149
 
143
150
  To implement a custom abstract interpretation analysis, we can just create a new class and extend the ${ctx.link(absint_visitor_1.AbstractInterpretationVisitor)}. The abstract interpretation visitor uses a \`StateDomain\` (e.g., a ${ctx.link(state_abstract_domain_1.StateAbstractDomain)}) to capture the current abstract state at each vertex in the control flow graph. We can then extend the callback functions of the ${ctx.link(absint_visitor_1.AbstractInterpretationVisitor)} to implement the abstract semantics of expressions, such as ${ctx.link(`${semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor.name}:::onNumberConstant`)}, ${ctx.link(`${absint_visitor_1.AbstractInterpretationVisitor.name}:::onFunctionCall`)} and ${ctx.link(`${semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor.name}:::onReplacementCall`)} (make sure to still call the respective super function). The abstract interpretation visitor provides the following functions to retrieve the currently inferred values:
144
151
 
@@ -159,7 +166,7 @@ If we now want to run the interval inference, we can write the following code:
159
166
 
160
167
  ${ctx.code(inferIntervals, { dropLinesStart: 1, dropLinesEnd: 5, hideDefinedAt: true })}
161
168
 
162
- We first need a ${ctx.linkPage('wiki/Analyzer', 'flowR analyzer')} (in this case, using the ${ctx.linkPage('wiki/Engines', 'tree-sitter engine')}). In this example, we want to analyze a small example code that assigns \`42\` to the variable \`x\`, randomly assigns \`6\` or \`12\` to the variable \`y\`, and assignes the sum of \`x\` and \`y\` to the variable \`z\`. For the abstract interpretation visitor, we need to retrieve the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}, ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')}, and context of the flowR anaylzer. For performance reasons, we construct the control flow graph without simplification passes, data flow information, and function definitions. We then create a new ${ctx.link(IntervalInferenceVisitor)} using the control flow graph, dataflow graph, normalized AST, and analyzer context, and start the visitor using ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'start', { hideClass: true })}. After the visitor is finished, we retrieve the inferred abstract state at the end of the program using ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'getEndState', { hideClass: true })}.
169
+ We first need a ${ctx.linkPage('wiki/Analyzer', 'flowR analyzer')} (in this case, using the ${ctx.linkPage('wiki/Engines', 'tree-sitter engine')}). In this example, we want to analyze a small example code that assigns \`42\` to the variable \`x\`, randomly assigns \`6\` or \`12\` to the variable \`y\`, and assignes the sum of \`x\` and \`y\` to the variable \`z\`. For the abstract interpretation visitor, we need to retrieve the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}, ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, ${ctx.linkPage('wiki/Control Flow Graph', 'control flow graph')}, and context of the flowR anaylzer. For performance reasons, we request the control flow graph without simplification passes; it is a view on the dataflow graph and is only projected once something walks it. We then create a new ${ctx.link(IntervalInferenceVisitor)} using the control flow graph, dataflow graph, normalized AST, and analyzer context, and start the visitor using ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'start', { hideClass: true })}. After the visitor is finished, we retrieve the inferred abstract state at the end of the program using ${ctx.linkM(absint_visitor_1.AbstractInterpretationVisitor, 'getEndState', { hideClass: true })}.
163
170
 
164
171
  If we now print the inferred abstract state at the end of the program, we get the following output:
165
172
 
@@ -500,7 +500,7 @@ For one file, the incremental state follows a fixed lifecycle:
500
500
  ${ctx.linkM(flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext, 'storeOldParseResults', { codeFont: true, realNameWrapper: 'i' })}.
501
501
  This tree is the baseline for the next incremental parse of that file.
502
502
  2. When a mutable file provider such as ${ctx.link('FlowrInlineTextFile')} is invalidated via
503
- ${ctx.linkM(flowr_file_1.FlowrInlineTextFile, 'invalidate', { codeFont: true, realNameWrapper: 'i' })},
503
+ ${ctx.linkM(flowr_file_1.FlowrFile, 'invalidate', { codeFont: true, realNameWrapper: 'i' })},
504
504
  the analyzer receives a file invalidation event and stores the file path together with the old source text.
505
505
  If the same file is invalidated again before the next parse, this stored old text is intentionally **not** replaced:
506
506
  the stored parse tree still belongs to the version from before the first invalidation, so the incremental parse must keep that matching old-content baseline.
@@ -510,7 +510,7 @@ For one file, the incremental state follows a fixed lifecycle:
510
510
  * the stored old source text from
511
511
  ${ctx.linkM(flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext, 'getOldContentOf', { codeFont: true, realNameWrapper: 'i' })}
512
512
 
513
- Using these together with the current file content, flowR computes a minimal ${ctx.link('Parser.Edit')} only when a new parse is actually requested.
513
+ Using these together with the current file content, ${ctx.link('computeEditRegion')} derives a minimal tree-sitter \`Parser.Edit\`, only when a new parse is actually requested.
514
514
  If the file content did not change, the previous tree can be reused directly.
515
515
  Otherwise, the edit is applied to the previous tree and Tree-sitter reparses incrementally instead of starting from scratch.
516
516
  4. The stored old-content entry is removed when it is used because it belongs only to that previous parse snapshot.
@@ -8,7 +8,7 @@ const doc_cfg_1 = require("./doc-util/doc-cfg");
8
8
  const simple_visitor_1 = require("../control-flow/simple-visitor");
9
9
  const control_flow_graph_1 = require("../control-flow/control-flow-graph");
10
10
  const cfg_simplification_1 = require("../control-flow/cfg-simplification");
11
- const extract_cfg_1 = require("../control-flow/extract-cfg");
11
+ const control_flow_graph_2 = require("../control-flow/control-flow-graph");
12
12
  const doc_dfg_1 = require("./doc-util/doc-dfg");
13
13
  const cfg_to_basic_blocks_1 = require("../control-flow/cfg-to-basic-blocks");
14
14
  const r_number_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-number");
@@ -17,7 +17,7 @@ const cfg_properties_1 = require("../control-flow/cfg-properties");
17
17
  const basic_cfg_guided_visitor_1 = require("../control-flow/basic-cfg-guided-visitor");
18
18
  const syntax_cfg_guided_visitor_1 = require("../control-flow/syntax-cfg-guided-visitor");
19
19
  const diff_cfg_1 = require("../control-flow/diff-cfg");
20
- const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
20
+ const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
21
21
  const dfg_cfg_guided_visitor_1 = require("../control-flow/dfg-cfg-guided-visitor");
22
22
  const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guided-visitor");
23
23
  const doc_issue_1 = require("./doc-util/doc-issue");
@@ -28,6 +28,7 @@ const doc_maker_1 = require("./wiki-mk/doc-maker");
28
28
  const doc_general_1 = require("./doc-util/doc-general");
29
29
  const doc_code_1 = require("./doc-util/doc-code");
30
30
  const df_helper_1 = require("../dataflow/graph/df-helper");
31
+ const objects_1 = require("../util/objects");
31
32
  const CfgLongExample = `f <- function(a, b = 3) {
32
33
  if(a > b) {
33
34
  return(a * b);
@@ -84,9 +85,6 @@ class CollectNumbersSyntaxVisitor extends syntax_cfg_guided_visitor_1.SyntaxAwar
84
85
  }
85
86
  class CollectNumbersDataflowVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfgGuidedVisitor {
86
87
  numbers = [];
87
- constructor(controlFlow, dataflow) {
88
- super({ controlFlow, dfg: dataflow, defaultVisitingOrder: 'forward' });
89
- }
90
88
  visitValue(node) {
91
89
  const astNode = this.config.dfg.idMap?.get(node.id);
92
90
  if (r_number_1.RNumber.is(astNode)) {
@@ -99,12 +97,9 @@ class CollectNumbersDataflowVisitor extends dfg_cfg_guided_visitor_1.DataflowAwa
99
97
  }
100
98
  class CollectSourcesSemanticVisitor extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {
101
99
  sources = [];
102
- constructor(controlFlow, normalizedAst, dataflow, ctx) {
103
- super({ controlFlow, normalizedAst, dfg: dataflow, ctx, defaultVisitingOrder: 'forward' });
104
- }
105
100
  onAssignmentCall({ source }) {
106
101
  if (source) {
107
- this.sources.push((0, node_id_1.recoverName)(source, this.config.normalizedAst.idMap) ?? '??');
102
+ this.sources.push(model_1.RNode.lexeme(this.getNormalizedAst(source)) ?? '??');
108
103
  }
109
104
  }
110
105
  getSources() {
@@ -120,13 +115,12 @@ class WikiCfg extends doc_maker_1.DocMaker {
120
115
  }
121
116
  async text({ ctx, shell }) {
122
117
  return `
123
- _flowR_ produces three main perspectives of the program: 1) a ${ctx.linkPage('wiki/Normalized AST', 'normalized version of the AST')}
124
- and 2) a ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, and 3) a control flow graph (CFG).
118
+ _flowR_ produces three main perspectives of the program: 1)&nbsp;a ${ctx.linkPage('wiki/Normalized AST', 'normalized version of the AST')},
119
+ 2)&nbsp;a ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, and 3)&nbsp;a control flow graph&nbsp;(CFG).
125
120
  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 ${(0, doc_query_1.linkToQueryOfName)('call-context')}).
126
121
 
127
- Please note that, mostly due to historical reasons, the ${ctx.linkPage('wiki/Dataflow Graph', 'control dependencies', 'control-dependencies')} that are stored directly within the
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.
129
- In contrast, the CFG describes a complete view of the program's control flow.
122
+ Please note that the control flow graph is a view on the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')},
123
+ similar to the ${ctx.linkPage('wiki/Dataflow Graph', 'call graph', 'perspectives-cg')}.
130
124
 
131
125
  ${(0, doc_structure_1.block)({
132
126
  type: 'TIP',
@@ -161,45 +155,57 @@ For now, let's look at a CFG for a program without any branching:
161
155
 
162
156
  ${(0, doc_code_1.codeBlock)('r', 'x <- 2 * 3 + 1')}
163
157
 
164
- The corresponding CFG is a directed, labeled graph with two types of edges (control and flow dependencies).
158
+ The corresponding CFG is a directed, labeled graph with two kinds of edges: flow edges and control edges.
165
159
 
166
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', ctx })}
160
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart LR\n', ctx })}
167
161
 
168
162
  ${(0, doc_structure_1.block)({
169
163
  type: 'IMPORTANT',
170
- 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!'
164
+ content: 'Edges are in flow order: an edge from `a` to `b` means that `b` is evaluated after `a`. Use `outgoingEdges` (or `successors`) to ask what may run next and `ingoingEdges` (or `predecessors`) to ask what ran before. The [visitors](#cfg-working) can walk either way.'
171
165
  })}
172
166
 
173
- Every normalized node of the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} that has any relevance to the
174
- execution is added and automatically linked using its id (similarly to vertices of the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}).
175
- Expressions, such as \`2 * 3\` get an additional node with an artificial id that ends in \`-exit\` to mark whenever their calculation is over.
167
+ Every vertex of the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} is a vertex here as well, carrying the same id
168
+ and hence linking back to the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}.
169
+ The control flow is modeled in post-order, so an expression such as \`2 * 3\` is reached once both operands have been
170
+ evaluated: the \`*\` vertex itself is where the calculation is over, and no extra node is needed.
176
171
 
177
172
  To gain a better understanding, let's have a look at a simple program with a single branching structure:
178
173
 
179
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, openCode: false, prefix: 'flowchart RL\n', ctx })}
174
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, openCode: false, prefix: 'flowchart LR\n', ctx })}
175
+
176
+ The condition \`u\` runs first and splits into the two branches, which join again on the \`if\` vertex itself.
177
+ The \`if\` is therefore where the structure is left (see the [structure](#cfg-structure) section for more details).
180
178
 
181
- Here, you can see the \`if\` node followed by the condition (in this case merely \`u\`) that then splits into two branches for the two possible outcomes.
182
- The \`if\` structure is terminated by the corresponding \`-exit\` node (see the [structure](#cfg-structure) section for more details).
179
+ Standing on \`u\`, the edges leaving it are control edges that name the \`if\`, so what a condition belongs to can be
180
+ read off locally. ${ctx.linkM(control_flow_graph_1.ControlFlowGraph, 'decides')} lists the constructs a vertex decides,
181
+ and ${ctx.linkM(control_flow_graph_1.ControlFlowGraph, 'entryOf')} goes the other way, from the \`if\` to the condition it starts with.
183
182
 
184
183
  For you to compare, the following shows the CFG of an \`if\` without an \`else\` branch:
185
184
 
186
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', ctx })}
185
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart LR\n', ctx })}
186
+
187
+ The \`||\` branches as well, as it only evaluates \`v\` when \`u\` did not already decide the answer.
188
+
189
+ Basic blocks group what always runs together. A block ends where the flow may go more than one way, and starts
190
+ where more than one way may arrive:
187
191
 
188
- Activating the calculation of basic blocks produces the following:
192
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 1\ny <- x + 2\nif(y) print(y)', { showCode: true, openCode: false, prefix: 'flowchart LR\n', simplifications: ['to-basic-blocks'], ctx })}
189
193
 
190
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], ctx })}
194
+ Compacting them is easier to read (although the reconstructed code can be slightly misleading, as flowR tries its
195
+ best to make it syntactically correct and hence adds closing braces which are technically not part of the block):
191
196
 
192
- Which is probably much more readable if compacted (although the reconstucted code can sometimes be slightly mislieading as flowR tries its best to make it syntactically correct and hence add closing braces etc. which are technically not part of the respective block):
197
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 1\ny <- x + 2\nif(y) print(y)', { showCode: true, openCode: false, prefix: 'flowchart LR\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
193
198
 
194
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
199
+ Branch-heavy code gains nothing from this: in \`if(u || v) 3\` every vertex may be reached or left in more than
200
+ one way, so every block holds a single vertex.
195
201
 
196
202
  The control flow graph also harmonizes with function definitions, and calls:
197
203
 
198
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() { 3 }\nf()', { showCode: true, openCode: true, prefix: 'flowchart RL\n', ctx })}
204
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() { 3 }\nf()', { showCode: true, openCode: true, prefix: 'flowchart LR\n', ctx })}
199
205
 
200
206
  ${(0, doc_structure_1.section)('Structure of the Control Flow Graph', 2, 'cfg-structure')}
201
207
 
202
- You can produce your very own control flow graph with ${ctx.link(extract_cfg_1.extractCfg)}.
208
+ You can produce your very own control flow graph with ${ctx.link(control_flow_graph_2.extractCfg)}.
203
209
  The ${ctx.link(control_flow_graph_1.ControlFlowGraph)} class describes everything required to model the control flow graph, with its edge types described by
204
210
  ${ctx.link('CfgEdge')} and its vertices by ${ctx.link('CfgVertex')}.
205
211
  However, you should be aware of the ${ctx.link('ControlFlowInformation')} interface which adds some additional information the CFG
@@ -210,28 +216,23 @@ ${ctx.hierarchy('ControlFlowInformation', { openTop: true })}
210
216
  To check whether the CFG has the expected shape, you can use the test function ${ctx.link('assertCfg')} which supports testing for
211
217
  sub-graphs as well (it provides diffing capabilities similar to ${ctx.link('assertDataflow')}).
212
218
  As the CFG may become unhandy for larger programs, there are simplifications available with ${ctx.link(cfg_simplification_1.simplifyControlFlowInformation)}
213
- (these can be passed on to the ${ctx.link(extract_cfg_1.extractCfg)} function as well).
219
+ (the ${ctx.linkPage('wiki/Analyzer', 'analyzer')} applies the ones you ask for when you request the control flow).
214
220
 
215
221
  ${(0, doc_structure_1.section)('CFG Vertices', 3, 'cfg-structure-vertices')}
216
222
 
217
223
  All vertex types are summarized in the ${ctx.link('CfgVertexType')} enum which currently contains the following types:
218
224
 
219
- ${Object.entries(control_flow_graph_1.CfgVertexType).map(([key, value]) => `- \`${key}\` (${value})`).join('\n')}
225
+ ${(0, objects_1.enumMembers)(control_flow_graph_1.CfgVertexType).map(([name, value]) => `- \`${name}\` (${value})`).join('\n')}
220
226
 
221
227
  We use the ${ctx.link('CfgBasicBlockVertex')} to represent [basic blocks](#cfg-basic-blocks) and separate
222
228
  expressions (${ctx.link('CfgExpressionVertex')}) and statements (${ctx.link('CfgStatementVertex')})
223
229
  as control flow units with and without side effects (if you want to, you can see view statements as effectful expressions).
224
- The markers (${ctx.link('CfgMarkerVertex')}) indicate the end of larger expressions/statements.
225
230
 
226
- To signal these links, the expressions and statements contain information about the attached markers:
231
+ Every vertex corresponds to a vertex of the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}: the control flow
232
+ is modeled in post-order, so a vertex is reached once everything it is made of has been evaluated, which makes it the
233
+ point at which the construct is left. That is why there are no separate marker vertices to close an \`if\` or a loop.
227
234
 
228
- ${ctx.hierarchy('CfgWithMarker', { openTop: true })}
229
-
230
- Similarly, the markers contain a link to their root:
231
-
232
- ${ctx.hierarchy('CfgWithRoot', { openTop: true })}
233
-
234
- In mermaid visualizations, we use rectangles for statements, rounded rectangles for expressions and circles for exit markers.
235
+ In mermaid visualizations, we use rectangles for statements and rounded rectangles for expressions.
235
236
  Blocks are visualized as boxes around the contained vertices.
236
237
 
237
238
  ${(0, doc_structure_1.block)({
@@ -239,88 +240,86 @@ ${(0, doc_structure_1.block)({
239
240
  content: `
240
241
  Every CFG vertex has a ${ctx.link('NodeId')} that links it to the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} (although basic blocks will find no counterpart as they are a structuring element of the CFG).
241
242
  Additionally, it may provide information on the called functions (in case that the current element is a function call).
242
- Have a look at the ${ctx.link('CfgBaseVertexWithMarker')} interface for more information.
243
+ Additionally, a function definition names the vertices of its body as children, which is the only way into that region.
243
244
  `.trim()
244
245
  })}
245
246
 
246
247
  ${(0, doc_structure_1.section)('CFG Edges', 3, 'cfg-structure-edges')}
247
248
 
248
- 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
249
- and the two interfaces: ${ctx.link('CfgFlowDependencyEdge')} and ${ctx.link('CfgControlDependencyEdge')}.
249
+ Every edge points the way execution goes: an edge from \`a\` to \`b\` means that \`b\` runs after \`a\`.
250
+ There are two kinds, told apart by the ${ctx.link('CfgEdgeType')} enum.
250
251
 
251
- ${(0, doc_structure_1.section)('Flow Dependencies', 4, 'cfg-flow-dependency')}
252
+ ${(0, doc_structure_1.section)('Flow Edges', 4, 'cfg-flow-edge')}
252
253
 
253
- The most common edge is the flow dependency&nbsp;(FD) which simply signals that the source vertex happens _after_ the target vertex in the control flow.
254
- So \`x; y\` would produce a flow dependency from \`y\` to \`x\` (additionally to the program-enveloping root expression list):
254
+ A flow edge says that the target simply runs next. In \`x; y\` there is one from \`x\` to \`y\`:
255
255
 
256
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'x; y', { showCode: false, prefix: 'flowchart RL\n', ctx })}
256
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x; y', { showCode: false, prefix: 'flowchart LR\n', ctx })}
257
257
 
258
- ${(0, doc_structure_1.section)('Control Dependencies', 4, 'cfg-control-dependency')}
258
+ ${(0, doc_structure_1.section)('Control Edges', 4, 'cfg-control-edge')}
259
259
 
260
- Control dependencies&nbsp;(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).
261
- They contain additional information to signal _when_ the source vertex is executed:
260
+ A control edge says the same, but only when a condition holds, which is how the branches of an \`if\` or the
261
+ body of a loop are attached. Diagrams draw these dashed.
262
262
 
263
- ${ctx.hierarchy('CfgControlDependencyEdge', { openTop: true })}
263
+ The edge *is* the ${ctx.link('ControlDependency')} it stands for, the same one the vertices behind it carry in
264
+ their \`cds\`, so it names the deciding vertex, whether it is the true or the false case, and whether the
265
+ decision comes from iterating a loop:
264
266
 
265
- The extra \`caused\` link signals the vertex that caused the control flow influence.
267
+ ${ctx.hierarchy('ControlDependency', { openTop: true })}
266
268
 
267
269
 
268
270
  ${await (async () => {
269
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart RL\n', ctx });
271
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart LR\n', ctx });
270
272
  return (0, doc_structure_1.details)('Example: if-else', exa);
271
273
  })()}
272
274
 
273
275
  ${await (async () => {
274
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart RL\n', ctx });
276
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart LR\n', ctx });
275
277
  return (0, doc_structure_1.details)('Example: while-loop', exa);
276
278
  })()}
277
279
  <br/>
278
280
 
279
- Please note that repeat loops do _not_ have control dependencies, as they repeat their body unconditionally.
281
+ Please note that repeat loops have no control edges, as they repeat their body unconditionally.
280
282
  Additionally, the control flow graph does not have to be connected. If you use a repeat without any exit condition,
281
- the corresponding exit markers are not reachable from the entry:
283
+ the loop is never left, so its vertex is not reachable from the entry:
282
284
 
283
285
  ${await (async () => {
284
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart RL\n', ctx });
286
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart LR\n', ctx });
285
287
  return (0, doc_structure_1.details)('Example: repeat-loop (infinite)', exa);
286
288
  })()}
287
289
 
288
290
  ${await (async () => {
289
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart RL\n', ctx });
291
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart LR\n', ctx });
290
292
  return (0, doc_structure_1.details)('Example: repeat-loop (with break)', exa);
291
293
  })()}
292
294
  <br/>
293
295
 
294
- In the context of a for-loop, the control dependency refer to whether the respective vector still has values to iterate over.
296
+ For a for-loop, the control edge says whether the sequence still has values to iterate over.
295
297
 
296
298
  ${await (async () => {
297
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart RL\n', ctx });
299
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart LR\n', ctx });
298
300
  return (0, doc_structure_1.details)('Example: for-loop', exa);
299
301
  })()}
300
302
 
301
303
  ${(0, doc_structure_1.section)('Extra: Call Links', 4, 'cfg-call-links')}
302
304
 
303
- 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)
304
- pass a matching ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} to it to incorporate the dataflow perspective into the CFG.
305
-
306
- The difference becomes obvious when we look at the code \`f <- function() b; f()\` first without the dataflow graph:
305
+ The control flow graph is a view on the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}: the dataflow analysis
306
+ records the control flow while it walks the program, and ${ctx.link(control_flow_graph_2.extractCfg)} projects it into the shape the control
307
+ flow analyses expect. Because of that, the interprocedural knowledge the dataflow analysis gained is available without
308
+ a second pass over the program.
307
309
 
308
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart RL\n', useDfg: false, ctx })}
310
+ Control flow itself stays intra-procedural. A call does not flow into the body of what it calls, and the body of a
311
+ function definition is not entered when the definition is evaluated &dash; it only produces the closure. What a call
312
+ may reach is named separately:
309
313
 
310
- And now, including dataflow information:
314
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart LR\n', ctx })}
311
315
 
312
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart RL\n', useDfg: true, ctx })}
313
-
314
- There are two important additions:
315
-
316
- 1. A new exit marker, canonically suffixed with \`${extract_cfg_1.ResolvedCallSuffix}\` signals that we are aware of the function call target.
317
- 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.
318
- 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.
316
+ A _calls_ attribute attached to the function call vertex holds the ${ctx.link('NodeId')} of the function definitions that
317
+ are called from this vertex, taken from the \`calls\` edges the dataflow analysis resolved.
319
318
 
320
319
  For built-in functions that are provided by flowR's built-in configuration (see the ${ctx.linkPage('wiki/Interface', 'interface wiki page')}) the CFG does not contain
321
320
  the additional information directly:
322
321
 
323
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'print(3)', { showCode: true, prefix: 'flowchart RL\n', ctx })}
322
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'print(3)', { showCode: true, prefix: 'flowchart LR\n', ctx })}
324
323
 
325
324
  This is due to the fact that the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} does contain the required call information (and there are no new control vertices to add as the built-in call has no target in the source code):
326
325
 
@@ -335,16 +334,16 @@ Yet, we can request basic blocks or transform an existing CFG into basic blocks
335
334
 
336
335
  Any program without any (un-)conditional jumps now contains a single basic block:
337
336
 
338
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: true, openCode: true, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
337
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: true, openCode: true, prefix: 'flowchart LR\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
339
338
 
340
339
  While the CFG without basic blocks is much bigger:
341
340
 
342
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', ctx })}
341
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart LR\n', ctx })}
343
342
 
344
343
  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").
345
344
  The vertices are still there, as elems of the ${ctx.link('CfgBasicBlockVertex')}:
346
345
 
347
- ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: false, ctx })}
346
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart LR\n', simplifications: ['to-basic-blocks'], simplify: false, ctx })}
348
347
 
349
348
  The benefit (for comprehensibility and algorithms) becomes more apparent when we look at a more complicated program:
350
349
 
@@ -352,12 +351,12 @@ ${(0, doc_code_1.codeBlock)('r', CfgLongExample)}
352
351
 
353
352
  With basic blocks, this code looks like this:
354
353
 
355
- ${await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
354
+ ${await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart LR\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
356
355
 
357
356
  Now, without basic blocks, this is a different story...
358
357
 
359
358
  ${await (async () => {
360
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n', ctx });
359
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart LR\n', ctx });
361
360
  return (0, doc_structure_1.details)('The full CFG', exa);
362
361
  })()}
363
362
 
@@ -423,6 +422,11 @@ visitors that incorporate various alternative perspectives:
423
422
  - [Semantic CFG Visitor](#cfg-traversal-semantic):\\
424
423
  Currently the most advanced visitor that combines syntactic with dataflow information.
425
424
 
425
+ The later ones need the dataflow graph and the ast as well. As the CFG is a view on the dataflow graph, and that
426
+ graph knows the ast, ${ctx.link(dfg_cfg_guided_visitor_1.cfgVisitorConfig)} takes both from the control flow you hand it:
427
+
428
+ ${(0, doc_code_1.codeBlock)('ts', "new MyVisitor(cfgVisitorConfig({ controlFlow, defaultVisitingOrder: 'forward' }))")}
429
+
426
430
  ${(0, doc_structure_1.section)('Basic CFG Visitor', 4, 'cfg-traversal-basic')}
427
431
 
428
432
  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.
@@ -476,7 +480,7 @@ Again, executing it with the CFG and Dataflow of the expression \`x - 1 + 2L * 3
476
480
 
477
481
  ${await (async () => {
478
482
  const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
479
- const visitor = new CollectNumbersDataflowVisitor(res.info, res.dataflow.graph);
483
+ const visitor = new CollectNumbersDataflowVisitor((0, dfg_cfg_guided_visitor_1.cfgVisitorConfig)({ controlFlow: res.info, defaultVisitingOrder: 'forward' }));
480
484
  visitor.start();
481
485
  const collected = visitor.getNumbers();
482
486
  return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
@@ -501,7 +505,7 @@ Executing it with the CFG and Dataflow of the expression \`x <- 2; 3 -> x; assig
501
505
 
502
506
  ${await (async () => {
503
507
  const res = await (0, doc_cfg_1.getCfg)(shell, 'x <- 2; 3 -> x; assign("x", 42 + 21)');
504
- const visitor = new CollectSourcesSemanticVisitor(res.info, res.ast, res.dataflow.graph, (0, flowr_analyzer_context_1.contextFromInput)(''));
508
+ const visitor = new CollectSourcesSemanticVisitor((0, dfg_cfg_guided_visitor_1.cfgVisitorConfig)({ controlFlow: res.info, ctx: (0, flowr_analyzer_context_1.contextFromInput)(''), defaultVisitingOrder: 'forward' }));
505
509
  visitor.start();
506
510
  const collected = visitor.getSources();
507
511
  return collected.map(n => '\n- `' + n + '`').join('');
@@ -524,39 +528,30 @@ With the ${ctx.linkPage('wiki/Dataflow Graph')} you already get a \`${edge_1.DfE
524
528
  (given that this function call does neither transform nor create a value).
525
529
  But the control flow perspective gives you more! Given a simple addition like \`x + 1\`, the CFG looks like this:
526
530
 
527
- ${await (async function () {
528
- const cfg = await (0, doc_cfg_1.getCfg)(shell, 'x + 1');
529
- const [plusVertexId, plusVertex] = cfg.info.graph.vertices().entries().filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === '+').toArray()[0];
530
- (0, assert_1.guard)(control_flow_graph_1.CfgVertex.isExpression(plusVertex));
531
- const numOfExits = control_flow_graph_1.CfgVertex.getEnd(plusVertex)?.length ?? 0;
532
- (0, assert_1.guard)(numOfExits === 1);
533
- return `${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart RL\n', ctx })}
534
-
535
- Looking at the binary operation vertex for \`+\` (with id \`${plusVertexId}\`) we see that it is linked to a single exit ("end marker") point: \`${control_flow_graph_1.CfgVertex.getEnd(plusVertex)?.[0] ?? '??'}\`.
536
- Checking this vertex essentially reveals all exit points of the expression &dash; in this case, this simply refers to the operands of the addition.
537
- However, the idea transfers to more complex expressions as well...
538
- `;
539
- })()}
531
+ ${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart LR\n', ctx })}
540
532
 
541
- ${(0, doc_structure_1.details)('Example: Exit Points for an if', await (async function () {
533
+ The control flow is modeled in post-order: a vertex is reached once everything it is made of has been evaluated.
534
+ For the addition above that means both operands come first and the \`+\` vertex itself is where they join again,
535
+ so the vertex of an expression *is* its exit point &dash; there are no separate marker vertices.
536
+
537
+ ${(0, doc_structure_1.details)('Example: Where an if joins again', await (async function () {
542
538
  const expr = 'if(u) 3 else 2';
543
539
  const cfg = await (0, doc_cfg_1.getCfg)(shell, expr);
544
- const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === 'if')[0];
545
- (0, assert_1.guard)(control_flow_graph_1.CfgVertex.isStatement(ifVertex));
546
- const numOfExits = control_flow_graph_1.CfgVertex.getEnd(ifVertex)?.length ?? 0;
547
- (0, assert_1.guard)(numOfExits === 1);
548
- return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart RL\n', ctx })}
549
-
550
- Looking at the if vertex for (with id \`${ifVertexId}\`) we see that it is again linked to a single exit point: \`${control_flow_graph_1.CfgVertex.getEnd(ifVertex)?.[0] ?? '??'}\`.
551
- Yet, now this exit vertex is linked to the two branches of the if statement (the \`then\` and \`else\` branch).
540
+ const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => cfg.ast.idMap.get(n)?.lexeme === 'if')[0];
541
+ (0, assert_1.guard)(control_flow_graph_1.CfgVertex.isStatement(ifVertex) || control_flow_graph_1.CfgVertex.isExpression(ifVertex));
542
+ return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart LR\n', ctx })}
543
+
544
+ Both branches of the if (with id \`${ifVertexId}\`) flow into the if vertex itself, which is therefore the single
545
+ point at which the statement is left, whichever branch ran.
552
546
  `;
553
547
  })())}
554
548
 
555
- 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).
549
+ Hence, the vertex of an expression names all of its exits, which is what keeps the graph a hammock graph without
550
+ any auxiliary vertices.
556
551
 
557
552
  ${(0, doc_structure_1.block)({
558
553
  type: 'WARNING',
559
- 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.'
554
+ content: 'Using basic blocks, this works just the same. However, please keep in mind that the vertex a control statement joins on does not have to be part of the same basic block as the branches leading to it.'
560
555
  })}
561
556
 
562
557
  `;