From 8f8d3d1a3c276be4be2e5d2e767ada564c47279a Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 13 Jan 2023 14:26:28 +0800 Subject: forest seems to be completed I seem to have finished the implementation of forests. Now it remains the implementation of the chain-rule machine, of which I have a rough plan now. --- grammar/src/lib.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'grammar/src/lib.rs') diff --git a/grammar/src/lib.rs b/grammar/src/lib.rs index 627ae6f..297cb66 100644 --- a/grammar/src/lib.rs +++ b/grammar/src/lib.rs @@ -462,6 +462,19 @@ impl Grammar { // REVIEW: Do we have a better way to record expansion information // than to compute the transitive closure? + // REVIEW: We need a way to eliminate those left-linearly expanded + // edges whose labels had already been considered, and we need to + // preserve the transition of the `left_p` property at the same + // time. + // + // Maybe we could decide to delete those edges in the + // `remove_predicate`? But we cannot access the states of NFA in + // that predicate, in the current design, thus we need to refactor + // some codes, it seems: we need a way to "compactify" an NFA, by + // a key function, in such a way that if two entries have the same + // key (determined by the key function), then only one, determined + // by another function, remains in the NFA. + /// A transformer of labels to be fed into /// [`closure`][nfa::default::nfa::DefaultNFA::closure], with the /// predicate that returns true if and only if the label of the @@ -483,7 +496,7 @@ impl Grammar { } // Compute if this is from left-linear expansion: it is so if - // and only if one if either the edges comes from left-linear + // and only if either one of the edges comes from left-linear // expansion or we are moving across a non-terminal expansion, // that is to say, the source of the second edge is the // starting edge of a non-terminal. -- cgit v1.2.3-18-g5258