-
Notifications
You must be signed in to change notification settings - Fork 10
Engines
This document was generated from 'src/documentation/print-engines-wiki.ts' on 2025-11-23, 09:01:16 UTC presenting an overview of flowR's engines (v2.6.2, using R v4.5.0). Please do not edit this file/wiki page directly.
To analyze R scripts, flowR needs to parse the R code and for that, we require a parser.
Originally, flowR shipped with an RShell, an asynchronous interface to the R interpreter, still available today.
Later we extended this with the RShellExecutor, the synchronous counterpart to the RShell.
However, these interfaces are relatively slow as they require communication with an underlying R interpreter.
Using tree-sitter, with its node bindings
and R grammar, we can provide the TreeSitterExecutor which
is synchronous, faster, and no longer needs an R installation, but requires the appropriate bindings.
To allow users of R to freely choose their backend between the R interpreter and the tree-sitter parser,
we provide the concept of engines.
Engines can be loaded with flowR's configuration file. Additionally, they are exposed with some command line options (e.g., when using the docker image of flowR):
-
--engine.r-shell.disabledto disable theRShellengine -
--engine.r-shell.r-path(which is the canonical version of--r-path) -
--engine.tree-sitter.disabledto disable theTreeSitterExecutorengine -
--engine.tree-sitter.laxto use lax parsing with tree-sitter -
--engine.tree-sitter.wasm-pathpass the path to the wasm of the r grammar of tree-sitter (see below) -
--engine.tree-sitter.tree-sitter-wasm-pathpass the path to the wasm of tree-sitter (see below) -
--default-engineto set the default engine to use
Warning
As the tree-sitter engine is only for parsing, it cannot execute R code. This engine is now the default.
In general, there is no need for you to pass custom paths using either
--engine.tree-sitter.wasm-path or
--engine.tree-sitter.tree-sitter-wasm-path.
However, you may want to experiment with the R grammar or provide a newer
one in case that of flowR is outdated.
To use a newer R grammar, you first must build the new wasm file. For this you have to:
- Install the dependencies with
npm ciin the tree-sitter-r repository. - Build the wasm using
tree-sitter build --wasm .the tree sitter cli which should be a dev dependency. - Pass the
tree-sitter-r.wasmto flowR.
For tree-sitter, please rely on the releases.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Linting & Testing (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information