Expand description
rpic-core — engine for the pic picture-drawing language.
Pipeline: source → lexer → parser → ast → [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::astand produces a placed-primitiveDrawingusing 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
Drawingto an SVG string. - token
- Token set for the pic language, mirroring dpic’s
dpic.toks.
Constants§
- CIRCUITS
- Bundled native circuit-element library (the
definedialect). Prepend it to source to useresistor,capacitor, … Seestd/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.