]> Repositorios git - scryer-prolog.git/commitdiff
begin adapting the techniques of "Compiling Large Disjunctions"
authorMark Thom <[email protected]>
Thu, 1 Sep 2022 23:03:00 +0000 (17:03 -0600)
committerMark <[email protected]>
Fri, 23 Jun 2023 19:52:24 +0000 (13:52 -0600)
src/iterators.rs

index 62054b044c95f2694ece6533fd350dfa23c1b82d..de091d4a11cb32f90a2ace09d97c598882508d21 100644 (file)
@@ -530,3 +530,38 @@ impl<'a> Iterator for ChunkedIterator<'a> {
         self.iter.next().map(|term| self.take_chunk(term))
     }
 }
+
+/*
+================================================================================
+
+This is a disjunction compilation experiment attempting to
+adapt the paper "Compiling Large Disjunctions" to Scryer Prolog.
+
+================================================================================
+*/
+
+enum VarInfo {
+    Perm,
+    Temp,
+    Void
+}
+
+pub struct ChunkInfo {
+    chunk_num: usize,
+    vars: Vec<(Rc<Var>, VarInfo)>,
+}
+
+pub struct BranchInfo {
+    branch_num: usize, // TODO: Rational?? or own type?
+    delta: usize, // TODO: Rational??
+    chunks: Vec<ChunkInfo>,
+}
+
+pub struct ControlIterator<'a> {
+    current_branch_num: usize, // TODO: same as above
+    state_stack: Vec<TermIterState<'a>>,
+    branch_map: IndexMap<Rc<Var>, Vec<BranchInfo>>,
+}
+
+impl ControlIterator {
+}