Skip to main content

Crate rpic_core

Crate rpic_core 

Source
Expand description

rpic-core — engine for the pic picture-drawing language.

Pipeline: source → lexerparserast → [eval] → placed primitives (ir) → render backends (svg, later PNG/PDF). This crate is pure (no file I/O); the CLI and WASM wrappers drive it.

Note: [eval] is the pic-language interpreter — a safe walker over a typed expression/geometry tree. It executes no arbitrary code.

Re-exports§

pub use eval::EvalError;
pub use eval::eval;
pub use ir::Drawing;
pub use lexer::LexError;
pub use lexer::lex;
pub use parser::ParseError;
pub use parser::parse;
pub use svg::to_svg;
pub use token::Token;

Modules§

ast
Abstract syntax tree for the pic language.
eval
Evaluator: walks the crate::ast and produces a placed-primitive Drawing using pic’s positioning semantics.
geom
Geometry primitives. pic works in a Cartesian plane with y pointing up; internal units are pic “inches” (scaled to device units by each backend).
ir
Intermediate representation: the placed-primitive tree produced by the evaluator and consumed by the render backends. All coordinates are absolute, in pic units (inches), y pointing up.
lexer
Hand-written lexer for the pic language.
parser
Recursive-descent parser for the pic drawing core.
svg
SVG 1.1 backend. Renders a Drawing to an SVG string.
token
Token set for the pic language, mirroring dpic’s dpic.toks.

Constants§

CIRCUITS
Bundled native circuit-element library (the define dialect). Prepend it to source to use resistor, capacitor, … See std/circuits.pic.

Functions§

animations_json
Build the JSON animation manifest array ([{id,effect,start,duration},…]) for an already-compiled drawing.
compile
Compile pic source into a placed-primitive Drawing.
compile_json
Compile to a single JSON object { "svg": "...", "animations": [...] }, or { "error": "..." } on failure. This is the entry point the WASM wrapper and browser playground consume.
render_svg
Compile pic source directly to an SVG string.