sim_codec_pratt/lib.rs
1//! Shared Pratt parser substrate for SIM codecs.
2//!
3//! A concrete codec owns its lexer and operator table, then hands a stream of
4//! [`SpannedPrattToken`] values to [`PrattCodecParser`]. The parser applies the
5//! shared precedence-climbing driver and returns a [`sim_kernel::LocatedExprTree`]
6//! with source spans, trivia, and decode-budget checks attached to the parsed
7//! expression nodes.
8//!
9//! The crate is intentionally language-neutral: token sources decide how source
10//! text becomes Pratt tokens, while this crate owns only the common grouping and
11//! expression-tree construction rules.
12
13#![forbid(unsafe_code)]
14#![deny(missing_docs)]
15
16mod builders;
17mod parser;
18#[cfg(test)]
19mod tests;
20mod token;
21
22pub use parser::{PrattCodecParser, raw_number_expr, raw_number_tag};
23pub use token::{PrattTokenSource, SpannedPrattToken};
24
25/// Cookbook recipes for this parser substrate, embedded at build time.
26pub static RECIPES: sim_cookbook::EmbeddedDir =
27 include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));