From 09ff5f929853cc2ba1a1ed7ddb20566cd8fe021d Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Fri, 11 Sep 2026 15:47:34 -0400 Subject: More Datalog --- Cargo.lock | 8 ++ Cargo.toml | 6 +- crates/elfmacros/Cargo.toml | 12 +++ crates/elfmacros/src/lib.rs | 0 crates/elfmind/src/knowledge.rs | 74 +++----------- crates/elfmind/src/knowledge/relation.rs | 163 +++++++++++++++++++++++++++++++ crates/elfmind/src/lib.rs | 1 + crates/elfmind/src/main.rs | 24 ++--- crates/elfmind/src/time.rs | 1 + 9 files changed, 214 insertions(+), 75 deletions(-) create mode 100644 crates/elfmacros/Cargo.toml create mode 100644 crates/elfmacros/src/lib.rs create mode 100644 crates/elfmind/src/knowledge/relation.rs create mode 100644 crates/elfmind/src/time.rs diff --git a/Cargo.lock b/Cargo.lock index 29ac8cf..5894d4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -768,6 +768,14 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" +[[package]] +name = "elfmacros" +version = "0.1.0" +dependencies = [ + "quote", + "syn 3.0.5", +] + [[package]] name = "elfmind" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index d47243b..694bb91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,13 +34,15 @@ teleia_macros = { path = "../teleia/crates/teleia_macros" } # engine bitflags = { version = "2.6.0", features = ["serde"] } # bitwise flags rand = { version = "=0.8.5", features = ["small_rng"] } # rng log = "0.4.21" # logging -lazy_static = "*" # global constants +lazy_static = "1.5.0" # global constants bimap = {version = "0.6.3", features = ["serde"]} # bijective maps strum = {version = "0.27.1", features = ["derive"]} # utility macros for enums enum-map = {version = "2.7.3", features = ["serde"]} # enum map serde = { version = "1.0.228", features = ["derive"] } # serialization bincode = {version = "2.0.1", features = ["serde"]} # binary serialization -itertools = "*" # iterator tools +itertools = "0.15.0" # iterator tools +syn = "3.0.5" # parser for proc macros +quote = "1.0.47" # quasiquotation for proc macros # cfg(target_arch = "wasm32") wasm-bindgen = "=0.2.100" # wasm bindings diff --git a/crates/elfmacros/Cargo.toml b/crates/elfmacros/Cargo.toml new file mode 100644 index 0000000..9c97e8d --- /dev/null +++ b/crates/elfmacros/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "elfmacros" +version.workspace = true +edition.workspace = true +authors.workspace = true + +[lib] +proc-macro = true + +[dependencies] +syn = { workspace = true } +quote = { workspace = true } \ No newline at end of file diff --git a/crates/elfmacros/src/lib.rs b/crates/elfmacros/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/crates/elfmind/src/knowledge.rs b/crates/elfmind/src/knowledge.rs index 3b90dee..cbcce28 100644 --- a/crates/elfmind/src/knowledge.rs +++ b/crates/elfmind/src/knowledge.rs @@ -1,12 +1,15 @@ -use std::collections::{HashMap, HashSet}; -use itertools::Itertools; +pub mod relation; +pub use relation::*; -use enum_map::{Enum, EnumMap}; +use crate::time::*; +use crate::item::*; +use crate::character::*; -use crate::item::Item; -use crate::character::Character; +use std::collections::{HashMap, HashSet}; +use itertools::Itertools; -type Time = u64; +use enum_map::EnumMap; +use strum::IntoDiscriminant; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Var { index: u64 } @@ -100,57 +103,6 @@ impl> Hole { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Enum)] -pub enum RelationSort { - HasItem, - UsedItemAt, - TimeIs, - FriendOf, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Relation { - HasItem(Hole, Hole), - UsedItemAt(Hole, Hole, Hole