From b306fe88edcb3d7c7628e155f67fd7e1c8c29c19 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 28 Feb 2023 22:14:15 +0800 Subject: 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. --- chain/src/item/genins.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'chain/src/item/genins.rs') 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> { /// 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, -- cgit v1.2.3-18-g5258