Expand description
The standalone OverPy-compatible .opy implementation (opy-rs).
Owns the OPY source-language surface of the opy-rs repository: a lexer,
an indentation-aware CST/parser with structured diagnostics and recovery,
token-level preprocessing (includes and #!define macros), semantic
resolution, and lowering into the opy-rs-owned Opy HIR contract
(hir::Program). Everything from source through the Opy HIR semantic
model is Workshop-independent: source analysis never depends on workshop-rs,
OverPy, or Node. The bounded source-to-Workshop compiler is exposed from
this same crate behind the explicit Compiler API.
Pipeline: lexer::lex → preprocess::preprocess →
parser::parse → lower::lower → Opy HIR (hir).
OverPy-compatible __script__("…") macros execute at compile time through
the bounded embedded macro runtime: script macros expand
during preprocessing with the reference’s argument-injection ABI, and
resource limits mirror the pinned reference constants
(macro_js::Limits::default()). Script-macro expansion is
compile-time behavior and is source-supported.
#!postCompileHook is recognized, parsed, validated, and recorded only
(see [preprocess] and CompileOutcome::post_compile_hook): the
The source implementation never executes the hook. Real hook execution
receives the final Workshop text produced by lowering and is
lowering-dependent (workshop-rs emission, issue #8); source analysis never
fabricates a Workshop payload.
This crate owns the OverPy source-language implementation, its bounded compiler, Workshop→OPY reconstruction, and the isolated differential harness entry points.
Re-exports§
pub use diag::OpyError;pub use diag::OpyResult;pub use lower::lower;pub use parser::parse;pub use preprocess::preprocess;pub use preprocess::preprocess_with_overlay;
Modules§
- cst
- The frontend’s concrete syntax tree (CST).
- diag
- Frontend diagnostics: structured, source-located failures.
- hir
- Opy HIR v2 — the OPY semantic model owned by
opy-rs. - lexer
- The native
.opylexer. - lower
- Semantic resolution and HIR lowering (#45).
- manifest
- The OPY semantic compatibility manifest (issue #109).
- parser
- The indentation-aware
.opyCST parser. - preprocess
.opypreprocessing: includes,#!definemacros (textual and__script__JavaScript-backed),#!postCompileHook, and expansion.- reconstruct
- Workshop IR → OPY reconstruction (issue #124).
- settings
- Scoped
settings { ... }extraction and JSONC parsing (#86). - support
- Compatibility support-matrix accessor (read-only).
- tooling
- Workshop-independent tooling APIs: check a project and query the resolved semantic model.
Structs§
- Compilation
Artifact - A validated WIR program and its emitted Workshop artifact for advanced integrations.
- Compile
Diagnostic - A versioned, source-attributed diagnostic exposed by the compile API.
- Compile
Outcome - The outcome of a compile with overlays.
- Compile
Output - A source compile result for ordinary embedding callers.
- Compile
Report - Complete versioned compile report for CLI, CI, and embedding consumers.
- Compile
Result - The machine-readable result for one compile operation.
- Compiler
- The compiler-facing integration object. Construction validates the public manifest/catalog contract once and exposes the pinned catalog identity.
- Compiler
Identity - Stable identity of the compiler that produced a compile report.
- Integration
Diagnostic - A source-attributed integration diagnostic.
- Integration
Error - An integration boundary failure.
- Link
Report - Results of the manifest-to-catalog cross-check.
- Post
Compile Hook Record - The recorded declaration of a
#!postCompileHookscript. - Script
Diagnostic - Script-runtime provenance retained alongside the OPY directive anchor.
Enums§
- Compile
Failure Class - Stable classification for a compile failure.
- Compile
Status - Whether compilation produced a valid Workshop artifact.
Constants§
- COMPILE_
SCHEMA_ VERSION - Version of the machine-readable compile report contract.
- LANGUAGE_
NAME - The producer identity for generated HIR.
- LANGUAGE_
VERSION - WORKSHOP_
RS_ VERSION - The exact released dependency contract consumed by this crate.
Functions§
- compile
- Compile one
.opysource end-to-end into the Opy HIR contract: preprocess (includes/defines) → parse (CST) → lower (HIR). - compile_
with_ overlay - Compile with open-document overlays: includes resolve to overlay text (keyed by the include string or the resolved canonical path) before the filesystem, so unsaved editor buffers participate in include resolution.
- compile_
with_ overlay_ outcome - Compile with open-document overlays while retaining the source file registry on parse/lower failure.