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, and the integration boundary toward workshop-rs is
documented rather than implemented here.
Pipeline: lexer::lex → preprocess::preprocess →
parser::parse → lower::lower → Opy HIR (hir).
OverPy-compatible __script__("…") macros execute at compile time through
the bounded embedded runtime (opy_macro_js): script macros expand
during preprocessing with the reference’s argument-injection ABI, and
resource limits mirror the pinned reference constants
(opy_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. Workshop→OPY reconstruction and the differential harness are not part of this crate (see the opy-rs roadmap).
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.- 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§
- Compile
Outcome - The outcome of a compile with overlays.
- Post
Compile Hook Record - The recorded declaration of a
#!postCompileHookscript.
Constants§
- LANGUAGE_
NAME - The producer identity for generated HIR.
- LANGUAGE_
VERSION
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.