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 /chain/src/item/genins.rs | |
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 'chain/src/item/genins.rs')
-rw-r--r-- | chain/src/item/genins.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chain/src/item/genins.rs b/chain/src/item/genins.rs index 41972c1..f48c8a8 100644 --- a/chain/src/item/genins.rs +++ b/chain/src/item/genins.rs @@ -14,7 +14,6 @@ use crate::{ Edge, }; use grammar::{Error as GrammarError, GrammarLabel, GrammarLabelType, TNT}; -#[allow(unused_imports)] use graph::{builder::BuilderMut, labelled::binary::PLGBuilderMut, Graph, RedirectGraph}; use core::borrow::Borrow; @@ -141,13 +140,17 @@ pub fn virtual_generate_fragment( Ok(result) } -// TODO: Examine `insert_item` again. +// TODO: Refactor `insert_item`. impl DefaultForest<ForestLabel<GrammarLabel>> { /// Insert an item derivation forest into a recording forest. /// /// We need the help of other things just for finding the correct /// places to insert these item fragments. + /// + /// # Steps + /// + /// This function performs the following steps. pub(crate) fn insert_item( &mut self, label: Edge, |