From fd887c8f9c97efbb437895aa6bc9bcdebb66e36f Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 3 Jun 2026 21:19:49 +0200 Subject: [PATCH 1/5] The base commit --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index 46846f8..cc77e59 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,6 @@ .{ .name = .zodd, - .version = "0.1.0-alpha.4", + .version = "0.1.0-alpha.5", .fingerprint = 0x2d03181bdd24914c, // Changing this has security and trust implications. .minimum_zig_version = "0.16.0", .dependencies = .{ From 7ef3d924464f98c3450efe7596e9972d352b0ad3 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 3 Jun 2026 21:29:54 +0200 Subject: [PATCH 2/5] Update `AGENTS.md` and `ROADMAP.md` --- .github/workflows/docs.yml | 2 +- .gitignore | 1 + AGENTS.md | 8 ++++---- Makefile | 1 + ROADMAP.md | 2 +- web/logo.svg | 36 ------------------------------------ 6 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 web/logo.svg diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f80f933..16caa56 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -43,7 +43,7 @@ jobs: - name: Assemble site run: | mkdir -p site/api - cp web/index.html web/main.js web/style.css web/logo.svg site/ + cp web/index.html web/main.js web/style.css logo.svg site/ cp zig-out/web/zodd.wasm site/ cp -r docs/api/* site/api/ diff --git a/.gitignore b/.gitignore index 3786309..0dc7d7e 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,4 @@ core.* .codex zig-pkg/ web/zodd.wasm +web/logo.svg diff --git a/AGENTS.md b/AGENTS.md index ff52f18..8c1a96b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,7 +33,7 @@ Priorities, in order: ## Repository Layout -- `src/lib.zig`: Public API entry point. Re-exports `Relation`, `Variable`, `Iteration`, `ExecutionContext`, join helpers, and extend primitives. +- `src/lib.zig`: Public API entry point. Re-exports `Relation`, `Variable`, `Iteration`, `Database`, join helpers, and extend primitives. - `src/zodd/relation.zig`: Immutable `Relation` type (sorted, deduplicated tuples). - `src/zodd/variable.zig`: Mutable `Variable` type for fixed-point iteration, plus the `gallop` search helper. - `src/zodd/iteration.zig`: `Iteration` driver for semi-naive evaluation. @@ -47,7 +47,7 @@ Priorities, in order: - `tests/`: Non-unit tests (`integration_tests.zig`, `regression_tests.zig`, `property_tests.zig`, `incremental_tests.zig`, `frontend_tests.zig`). - `web/`: Web frontend. `zodd_wasm.zig` is the Wasm wrapper built by `zig build wasm`; `index.html`, `main.js`, and `style.css` are the UI; `smoke_test.mjs` is the Node.js smoke test run by `make web-test`. -- `examples/`: Self-contained example programs (`e1_network_reachability.zig` through `e6_dependency_resolution.zig`) built as executables via +- `examples/`: Self-contained example programs (`e1_network_reachability.zig` through `e7_datalog_frontend.zig`) built as executables via `build.zig`. - `.github/workflows/`: CI workflows (`tests.yml` for unit and integration tests plus the Wasm smoke test, `docs.yml` for deploying the website: the web frontend at the site root and API docs under `/api`). @@ -95,7 +95,7 @@ Please do not add further dependencies without prior discussion. - Zig version: 0.16.0 (as declared in `build.zig.zon` and the Makefile's `ZIG_LOCAL` path). CI pins the version declared in `build.zig.zon`. - Formatting is enforced by `zig fmt`. Run `make format` before committing. - Naming follows Zig standard-library conventions: `camelCase` for functions (e.g. `joinInto`, `extendInto`, `fromSlice`), `snake_case` for local - variables and struct fields, `PascalCase` for types and structs (e.g. `Relation`, `Variable`, `ExecutionContext`), and `SCREAMING_SNAKE_CASE` for + variables and struct fields, `PascalCase` for types and structs (e.g. `Relation`, `Variable`, `Database`), and `SCREAMING_SNAKE_CASE` for top-level compile-time constants. ## Required Validation @@ -141,7 +141,7 @@ Good first tasks: Before coding: -1. Identify which module(s) the change touches (`relation`, `variable`, `iteration`, `join`, `extend`, `index`, `aggregate`, or `context`). +1. Identify which module(s) the change touches (`relation`, `variable`, `iteration`, `join`, `extend`, `index`, `aggregate`, or `database`). 2. Consider whether a new join or extension needs a matching index or anti-variant. 3. Check whether the change is public-API-visible (like re-exported from `src/lib.zig`); if so, treat it as a breaking or additive API change deliberately. diff --git a/Makefile b/Makefile index 2ef1e4b..93d2bdc 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,7 @@ web: ## Build the web frontend Wasm module and stage it under web/ @echo "Building the web frontend Wasm module..." $(ZIG) build wasm cp $(BUILD_DIR)/web/zodd.wasm web/zodd.wasm + cp -f logo.svg web/logo.svg web-serve: web ## Build and serve the web frontend at http://localhost:8085 @echo "Serving web/ at http://localhost:8085 ..." diff --git a/ROADMAP.md b/ROADMAP.md index 934752d..ce67272 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -30,7 +30,7 @@ This document outlines the features implemented in Zodd and the future goals for - [ ] CLI - [ ] Streaming input - [x] Rule DSL (textual Datalog frontend with a parser, a builder API, stratified negation, and aggregates) -- [ ] Query planner +- [x] Query planner - [ ] Magic sets ### Development and Testing diff --git a/web/logo.svg b/web/logo.svg deleted file mode 100644 index c2bb7cc..0000000 --- a/web/logo.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - Zodd - - - - - - - - - - - - - - - - - - - - - - - - - From de680c42500472ac7e01e1cb8b7a8c66e7e77880 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 3 Jun 2026 21:31:46 +0200 Subject: [PATCH 3/5] WIP --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 93d2bdc..54e236d 100644 --- a/Makefile +++ b/Makefile @@ -68,13 +68,13 @@ lint: ## Check code style and formatting of Zig files @echo "Running code style checks..." $(ZIG) fmt --check $(SRC_DIR) $(TEST_DIR) web/zodd_wasm.zig -web: ## Build the web frontend Wasm module and stage it under web/ +web: ## Build the web frontend Wasm module and stage it under `web/` @echo "Building the web frontend Wasm module..." $(ZIG) build wasm cp $(BUILD_DIR)/web/zodd.wasm web/zodd.wasm cp -f logo.svg web/logo.svg -web-serve: web ## Build and serve the web frontend at http://localhost:8085 +web-serve: web ## Build and serve the web frontend locally @echo "Serving web/ at http://localhost:8085 ..." python3 -m http.server 8085 --directory web From 08eed57a13ff56a0e352b8ef0235e0955a9cd86a Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 3 Jun 2026 21:39:04 +0200 Subject: [PATCH 4/5] WIP --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 54e236d..5fef6f3 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ docs: ## Generate API documentation mkdir -p $(DOC_OUT) cp -r $(BUILD_DIR)/docs/* $(DOC_OUT) -docs-serve: ## Serve API documentation locally +docs-serve: docs ## Serve API documentation locally @echo "Serving documentation locally" cd $(DOC_OUT) && python3 -m http.server 8000 From 30c1f15545c7eebefc91f19c208ab8ed38d14168 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 3 Jun 2026 21:47:18 +0200 Subject: [PATCH 5/5] WIP --- AGENTS.md | 2 +- src/lib.zig | 2 +- src/zodd/{index.zig => secondary_index.zig} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/zodd/{index.zig => secondary_index.zig} (100%) diff --git a/AGENTS.md b/AGENTS.md index 8c1a96b..9da557d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,7 +39,7 @@ Priorities, in order: - `src/zodd/iteration.zig`: `Iteration` driver for semi-naive evaluation. - `src/zodd/join.zig`: Merge-join algorithms (`joinHelper`, `joinInto`, `joinAnti`). - `src/zodd/extend.zig`: Leaper-based extension primitives (`ExtendWith`, `FilterAnti`, `ExtendAnti`, `extendInto`). -- `src/zodd/index.zig`: Indexes for keyed lookups. +- `src/zodd/secondary_index.zig`: Indexes for keyed lookups. - `src/zodd/aggregate.zig`: Group-by and aggregation operations. - `src/zodd/frontend/`: Datalog frontend. `program.zig` is the public `Database` API; `token.zig` and `parser.zig` parse textual Datalog; `ast.zig` and `builder.zig` hold the shared IR and the programmatic builder; `analyze.zig` checks safety and stratification; diff --git a/src/lib.zig b/src/lib.zig index 0bd3aaf..a85ec7f 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -52,7 +52,7 @@ const variable = @import("zodd/variable.zig"); const iteration = @import("zodd/iteration.zig"); const join = @import("zodd/join.zig"); const extend = @import("zodd/extend.zig"); -const index_mod = @import("zodd/index.zig"); +const index_mod = @import("zodd/secondary_index.zig"); const aggregate_mod = @import("zodd/aggregate.zig"); const frontend = @import("zodd/frontend/program.zig"); diff --git a/src/zodd/index.zig b/src/zodd/secondary_index.zig similarity index 100% rename from src/zodd/index.zig rename to src/zodd/secondary_index.zig