Expand description
rlang — R as a fusevm frontend.
Pipeline: lexer → parser builds an R AST → compiler lowers it to a
fusevm::Chunk (plus a chunk per closure body) → fusevm executes it, calling
back into the host through registered builtins for every R-specific
operation. There is no bespoke VM or JIT here — execution and codegen live in
fusevm.
Re-exports§
pub use embed::run_program;
Modules§
- aot
- Ahead-of-time compilation.
- aot_
runtime - AOT runtime hook for a standalone
.fvmexecutable. - ast
- The R abstract syntax tree.
- banner
- The REPL banner (shown only for the interactive
Rscript --repl, never for script execution). - builtins
- Registered fusevm builtins, R’s vectorized operators, and the primitive function library.
- cache
- rkyv-backed bytecode cache for compiled R scripts (mirrors
zshrs/rubylang/vimlrs). Versioned from day one so an
.Rfile that compiled once never breaks on a later run. - cli
- Command-line interface for the
Rscriptbinary. - collate
- Character ordering in R’s collation locale, not by code point.
- compiler
- Lower the R AST to
fusevm::Chunk. - dap
- Debug Adapter Protocol over stdio (
Rscript --dap). - deparse
- R’s
deparsefor the rlang AST — a port of GNU R’ssrc/main/deparse.c(deparse2buff,args2buff,print2buff,writeline,linebreak). - docs
- The primitive reference corpus: a signature and a description for every
name in
crate::builtins::PRIMITIVESandcrate::builtins::OPERATORS. - embed
- The uniform embedding entry point shared by the fusevm frontends.
- ffi
- R’s bridge to fusevm’s inline-Rust FFI (
fusevm::ffi). - host
- The R value heap and runtime, reached from fusevm through registered
builtins (
register_builtin). - intercepts
- Method-call intercepts (aspect-oriented advice) — a glob-matched registry of before/after/around hooks keyed by function-name pattern.
- lexer
- The R lexer.
- linalg
- Dense linear algebra behind
solve,detanddeterminant. - lsp
- Language Server Protocol over stdio (
Rscript --lsp). - nmath
- The normal distribution from R’s standalone math library (
src/nmath). - parser
- Recursive-descent parser for R.
- primargs
- The formals R shows for its primitives.
- re
- The regular-expression engine behind
grepl,sub,gsub,regexpr,strsplitand friends. - rembed
- CRAN bridge: an embedded GNU R, reached over FFI.
- repl
- Interactive REPL for
Rscript— areedlineline editor over a persistent host, so bindings and functions carry across prompts. - rng
- R’s uniform random number generator and the samplers built on it.
- strwidth
- String measurement in R’s three units, and R’s per-character case mapping.
- tiers
- Which fusevm execution tier a program’s bytecode actually reaches.
Enums§
- Value
- Core value type — what lives on the stack and in variables.
Functions§
- compile
- Compile a source string to a runnable program.
- compile_
no_ slots - Compile without binding top-level locals to native slots — for the REPL, which persists variables across prompts through the shared environment.
- disasm
- Disassemble a compiled program: the top-level chunk and every closure body, each op numbered by its index so jump targets read directly.
- eval_
capture - Evaluate
srcwith top-level echo on, capturing everything R would write to stdout (autoprint,print,cat) into a returned string instead of the process stdout. This is the entry point the wasm build hands to its JS host (src/wasm.rs) — wasm has no real stdout — and it is unit-testable on native targets. A compile or run error is appended as a trailingError:line so a single call always yields a complete transcript. - eval_
captured - Run R source with
varsbound and the transcript captured, returning the program’s outcome alongside everything it printed. - eval_
file - Read and run a
.Rfile. - eval_
quiet - Like
eval_str, but with the top-level echo off — for embedding and for tests that want the value, not the transcript. - eval_
str - Parse, compile, and run R source on a fresh host, echoing top-level values
the way
Rscriptdoes. Returns the last expression’s value. - eval_
to_ string - Evaluate
srcand return whatprintwould show for the last value — the convenience entry point for tests. - run_
compiled - Run an already-compiled program on the current (freshly reset) host.