pub fn parse_algol_expr_with_table(
cx: &mut Cx,
table: PrattTable,
source: &str,
) -> Result<Expr>Expand description
Parses Algol source into a bare Expr using a caller-supplied operator
table, lowering raw number literals through cx.
This is the entry point the Shape engine uses to parse infix grammar with
a custom operator table rather than crate::default_pratt_table. It
applies the default DecodeLimits::max_input_bytes ceiling to source
before parsing; call parse_algol_expr_with_table_and_budget to honor a
caller-supplied budget. Number literals are lowered lossily: a literal no
number domain accepts is left as the tagged raw form rather than raising an
error.
ยงExamples
use sim_codec_algol::{default_pratt_table, parse_algol_expr_with_table};
use sim_kernel::Expr;
use sim_test_support::{core_cx, register_f64_number_domain};
let mut cx = core_cx();
register_f64_number_domain(&mut cx);
let expr = parse_algol_expr_with_table(&mut cx, default_pratt_table(), "1 + 2 * 3").unwrap();
assert!(matches!(expr, Expr::Infix { .. }));