Skip to main content

Crate rlang

Crate rlang 

Source
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 .fvm executable.
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 .R file that compiled once never breaks on a later run.
cli
Command-line interface for the Rscript binary.
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 deparse for the rlang AST — a port of GNU R’s src/main/deparse.c (deparse2buff, args2buff, print2buff, writeline, linebreak).
docs
The primitive reference corpus: a signature and a description for every name in crate::builtins::PRIMITIVES and crate::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, det and determinant.
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, strsplit and friends.
rembed
CRAN bridge: an embedded GNU R, reached over FFI.
repl
Interactive REPL for Rscript — a reedline line 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 src with 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 trailing Error: line so a single call always yields a complete transcript.
eval_captured
Run R source with vars bound and the transcript captured, returning the program’s outcome alongside everything it printed.
eval_file
Read and run a .R file.
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 Rscript does. Returns the last expression’s value.
eval_to_string
Evaluate src and return what print would show for the last value — the convenience entry point for tests.
run_compiled
Run an already-compiled program on the current (freshly reset) host.