diff options
author | JSDurand <mmemmew@gmail.com> | 2023-02-28 22:14:15 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-02-28 22:14:15 +0800 |
commit | b306fe88edcb3d7c7628e155f67fd7e1c8c29c19 (patch) | |
tree | 2e83af12ad669a9f356d697c02c12abe272b2855 /grammar/src | |
parent | b63a9c05d7f86320b6cfbb4569b1880f2b804eb9 (diff) |
Add a type Reducer for recording extra reductions
In the chain-rule machine, we need to skip through edges whose labels
are "accepting", otherwise the time complexity will be high even for
simple grammars. This implies that we will skip some "jumping up" in
the item derivation forest. So we need to record these extra jumping
up, in order to jump up at a later point.
This Reducer type plays this role. But I still need more experiments
to see if this approach works out as I intended.
Diffstat (limited to 'grammar/src')
-rw-r--r-- | grammar/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/grammar/src/lib.rs b/grammar/src/lib.rs index 21ce2b4..54d9ebc 100644 --- a/grammar/src/lib.rs +++ b/grammar/src/lib.rs @@ -374,9 +374,9 @@ impl Grammar { for (index, accumulator) in self.accumulators.iter().copied().enumerate() { let shifted_accumulator = accumulator << 1; - // NOTE: Clippy suggests to call `cmp`, but it seems - // compiler might not yet be smart enough to inline that - // call, so I just silence clippy here. + // NOTE: Clippy suggests to call `cmp`, but it seems that + // the compiler might not yet be smart enough to inline + // that call, so I just silence clippy here. #[allow(clippy::comparison_chain)] if pos == shifted_accumulator { return Some(index); |