1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Context-free grammar types and Earley parser.
//!
//! This module provides:
//! - [`Grammar`]: Context-free grammar representation
//! - [`EarleyParser`]: Earley parser modified for lattice input
//! - [`ParseForest`]: Compact representation of ambiguous parses
//! - [`ParseTree`]: Single parse tree extraction
//!
//! # Earley Parsing on Lattices
//!
//! The Earley parser is modified to work with lattices instead of strings:
//! - The Scanner step follows lattice edges instead of string positions
//! - Multiple edges at a position are handled naturally
//! - The resulting parse forest can filter the lattice to grammatical paths
//!
//! # Example
//!
//! ```rust,ignore
//! use lling_llang::cfg::{GrammarBuilder, EarleyParser};
//!
//! let grammar = GrammarBuilder::new()
//! .rule("S", &["NP", "VP"])
//! .rule("NP", &["Det", "N"])
//! .rule("VP", &["V", "NP"])
//! .terminal("Det", &["the", "a"])
//! .terminal("N", &["dog", "cat"])
//! .terminal("V", &["saw", "chased"])
//! .build();
//!
//! let parser = EarleyParser::new(&grammar);
//! let forest = parser.parse_lattice(&lattice)?;
//! ```
pub use GrammarBuilder;
pub use ;
pub use ;
pub use ;
pub use ;