diff --git a/Cargo.toml b/Cargo.toml index b85ae18..468aa45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,6 @@ edition = "2024" lalrpop = "0.22" [dependencies] +petgraph = { version = "0.8" } regex = { version = "1.11", features = ["unicode-bool"] } lalrpop-util = { version = "0.22", features = ["lexer", "unicode"] } diff --git a/src/main.rs b/src/main.rs index cd2a8a0..56c36c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,9 +11,9 @@ fn main() -> std::io::Result<()> { // std::thread::sleep(std::time::Duration::new(2, 0)); // println!("{}", now.elapsed().as_micros()); - examples::stats()?; + // examples::stats()?; - // examples::freq()?; + examples::freq()?; // examples::hoop()?; @@ -23,7 +23,7 @@ fn main() -> std::io::Result<()> { // examples::limit_freq()?; - examples::fast_freq()?; + // examples::fast_freq()?; Ok(()) } diff --git a/src/rsprocess/grammar.lalrpop b/src/rsprocess/grammar.lalrpop index 6c7eeba..bbc8673 100644 --- a/src/rsprocess/grammar.lalrpop +++ b/src/rsprocess/grammar.lalrpop @@ -19,6 +19,16 @@ grammar(translator: &mut Translator); // order match { + "nill", + "{", "}", + "[", "]", + "(", ")", + "<", ">", + "r:", "i:", "p:", + "-", "^", + "true", "false", + "inW", "inR", "inI", "inP" +} else { r"[0-9]+" => NUMBER } else { // r"([[:alpha:]]|\p{Emoji})([[:word:]]|\p{Emoji})*" => WORD @@ -98,6 +108,7 @@ Boxed_CTX_process: Rc = { } CTX_process: RSprocess = { + "nill" => RSprocess::Nill, "." => RSprocess::EntitySet{ entities: c, next_process: Rc::new(k) }, "(" ")" => k, @@ -109,7 +120,6 @@ CTX_process: RSprocess = { RSprocess::WaitEntity{ repeat: n, repeated_process: Rc::new(k1), next_process: Rc::new(k) }, - "nill" => RSprocess::Nill, => RSprocess::RecursiveIdentifier{ identifier: translator.encode(identifier) diff --git a/src/rsprocess/transitions.rs b/src/rsprocess/transitions.rs index 6bc7378..ec3d9d2 100644 --- a/src/rsprocess/transitions.rs +++ b/src/rsprocess/transitions.rs @@ -21,7 +21,7 @@ pub fn unfold( if let Some(newprocess) = newprocess { unfold(environment, newprocess) } else { - Err(format!("Recursive call to missing symbol: {identifier}")) + Err(format!("Missing symbol in context: {identifier}")) } } RSprocess::EntitySet { diff --git a/testing/first.experiment b/testing/first.experiment index 0b289d6..9a30e62 100644 --- a/testing/first.experiment +++ b/testing/first.experiment @@ -1,2 +1,2 @@ Weights: 10,10 -Sets: {a,b},{a, 㐀, 豈} \ No newline at end of file +Sets: {a,b},{a} \ No newline at end of file diff --git a/testing/first.system b/testing/first.system index 8d16057..3314710 100644 --- a/testing/first.system +++ b/testing/first.system @@ -1,4 +1,4 @@ -Environment: [x = {a}.ñ, ñ =({a}.nill + {b}.nill)] +Environment: [x = {a}.y, y =({a}.nill + {b}.nill)] Initial Entities: {a, b} -Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nil)] -Reactions: ([r: {a,b}, i: {c}, p: {b, ñ, 㐀, 豈, a12-3, 🙏}]) +Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nill)] +Reactions: ([r: {a,b}, i: {c}, p: {b}])