Fixing ordering, using petgraph
This commit is contained in:
@ -7,5 +7,6 @@ edition = "2024"
|
|||||||
lalrpop = "0.22"
|
lalrpop = "0.22"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
petgraph = { version = "0.8" }
|
||||||
regex = { version = "1.11", features = ["unicode-bool"] }
|
regex = { version = "1.11", features = ["unicode-bool"] }
|
||||||
lalrpop-util = { version = "0.22", features = ["lexer", "unicode"] }
|
lalrpop-util = { version = "0.22", features = ["lexer", "unicode"] }
|
||||||
|
|||||||
@ -11,9 +11,9 @@ fn main() -> std::io::Result<()> {
|
|||||||
// std::thread::sleep(std::time::Duration::new(2, 0));
|
// std::thread::sleep(std::time::Duration::new(2, 0));
|
||||||
// println!("{}", now.elapsed().as_micros());
|
// println!("{}", now.elapsed().as_micros());
|
||||||
|
|
||||||
examples::stats()?;
|
// examples::stats()?;
|
||||||
|
|
||||||
// examples::freq()?;
|
examples::freq()?;
|
||||||
|
|
||||||
// examples::hoop()?;
|
// examples::hoop()?;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
|
|
||||||
// examples::limit_freq()?;
|
// examples::limit_freq()?;
|
||||||
|
|
||||||
examples::fast_freq()?;
|
// examples::fast_freq()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,16 @@ grammar(translator: &mut Translator);
|
|||||||
|
|
||||||
// order
|
// order
|
||||||
match {
|
match {
|
||||||
|
"nill",
|
||||||
|
"{", "}",
|
||||||
|
"[", "]",
|
||||||
|
"(", ")",
|
||||||
|
"<", ">",
|
||||||
|
"r:", "i:", "p:",
|
||||||
|
"-", "^",
|
||||||
|
"true", "false",
|
||||||
|
"inW", "inR", "inI", "inP"
|
||||||
|
} else {
|
||||||
r"[0-9]+" => NUMBER
|
r"[0-9]+" => NUMBER
|
||||||
} else {
|
} else {
|
||||||
// r"([[:alpha:]]|\p{Emoji})([[:word:]]|\p{Emoji})*" => WORD
|
// r"([[:alpha:]]|\p{Emoji})([[:word:]]|\p{Emoji})*" => WORD
|
||||||
@ -98,6 +108,7 @@ Boxed_CTX_process: Rc<RSprocess> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CTX_process: RSprocess = {
|
CTX_process: RSprocess = {
|
||||||
|
"nill" => RSprocess::Nill,
|
||||||
<c: Set_of_entities> "." <k: CTX_process> =>
|
<c: Set_of_entities> "." <k: CTX_process> =>
|
||||||
RSprocess::EntitySet{ entities: c, next_process: Rc::new(k) },
|
RSprocess::EntitySet{ entities: c, next_process: Rc::new(k) },
|
||||||
"(" <k: CTX_process> ")" => k,
|
"(" <k: CTX_process> ")" => k,
|
||||||
@ -109,7 +120,6 @@ CTX_process: RSprocess = {
|
|||||||
RSprocess::WaitEntity{ repeat: n,
|
RSprocess::WaitEntity{ repeat: n,
|
||||||
repeated_process: Rc::new(k1),
|
repeated_process: Rc::new(k1),
|
||||||
next_process: Rc::new(k) },
|
next_process: Rc::new(k) },
|
||||||
"nill" => RSprocess::Nill,
|
|
||||||
<identifier: Literal> =>
|
<identifier: Literal> =>
|
||||||
RSprocess::RecursiveIdentifier{
|
RSprocess::RecursiveIdentifier{
|
||||||
identifier: translator.encode(identifier)
|
identifier: translator.encode(identifier)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ pub fn unfold(
|
|||||||
if let Some(newprocess) = newprocess {
|
if let Some(newprocess) = newprocess {
|
||||||
unfold(environment, newprocess)
|
unfold(environment, newprocess)
|
||||||
} else {
|
} else {
|
||||||
Err(format!("Recursive call to missing symbol: {identifier}"))
|
Err(format!("Missing symbol in context: {identifier}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RSprocess::EntitySet {
|
RSprocess::EntitySet {
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
Weights: 10,10
|
Weights: 10,10
|
||||||
Sets: {a,b},{a, 㐀, 豈}
|
Sets: {a,b},{a}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
Environment: [x = {a}.ñ, ñ =({a}.nill + {b}.nill)]
|
Environment: [x = {a}.y, y =({a}.nill + {b}.nill)]
|
||||||
Initial Entities: {a, b}
|
Initial Entities: {a, b}
|
||||||
Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nil)]
|
Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nill)]
|
||||||
Reactions: ([r: {a,b}, i: {c}, p: {b, ñ, 㐀, 豈, a12-3, 🙏}])
|
Reactions: ([r: {a,b}, i: {c}, p: {b}])
|
||||||
|
|||||||
Reference in New Issue
Block a user