diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-29 19:37:04 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-29 19:37:04 -0400 |
| commit | 310c42d3664432eda6bae33e975109cbb8ef9cd0 (patch) | |
| tree | 7b0745dee88103c8e7c89c9685fe1e9e0cdac152 /dlang/flake.nix | |
| parent | D: what a source holds, and what a database holds unread (diff) | |
D: ocda-read, the reader, over the library, of every form
One reader where there were two. sisudoc-ssp-reader read a .ssp and
sisudoc-ocda-db-reader a .ocda.db, each with its own parser; this one
is built on the library, so every mode reads a .ssp, a .ocda.db and a
.sisupod, and says the same thing of each. Its output modules are the
.ssp reader's, copied (the reader repositories are unchanged) and
moved onto the library's model, which was the reader's types renamed
and added to. From the database reader, --languages and --files.
ocda-read [--tree|--outline|--html|--llm-text|--llm-jsonl|--images|
--verify --image-dir=<d>|--languages|--files|
--report-unknown|--validate] <file> [lang]
Two modes are about the file and say so: --files answers for a
.ocda.db, and --validate checks a .ssp as text and refuses anything
else. Where a file holds several languages and none is named, every
form reads the first and says so, where the database used to take one
and the pod refuse.
In src/read/ beside the library in src/ocda/; dub.json keeps it out of
the library (configurations "library" and "ocda-read"), and the flake
builds it as a package. The flake's default is now all three programs
in one bin/: built separately into the same result link, each replaced
the one before, and the pipeline's dump looked for ocda-dump where
only ocda-agree was left.
Checked over the 36 document-languages:
- against the .ssp reader, on a .ssp, byte for byte after the first
line (Parsed: is Read:): --tree, --html, --llm-text, --llm-jsonl,
--images, --verify, --validate, 36 of 36; the summary differs only
in the closing hint, which names the two new modes;
- against the database reader, on a .ocda.db: --files 27 of 27, and
--languages 27 of 27 on language, source and digest (its id column,
the database's own key, is left out);
- the same output from the .ssp, the .ocda.db and the .sisupod: the
summary and --tree, --html, --llm-text, --llm-jsonl, --images and
--report-unknown, 36 of 36; --languages, .ocda.db == .sisupod 27 of
27, and a single-language .ssp == its database, 26 of 26.
Not reproduced, deliberately: the database reader's --outline, which
ordered the headings by their position within their own section, so
that the toc and the "(skip)" headings of other sections fell among
the body's. --outline here is --tree.
(assisted by Claude-Code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'dlang/flake.nix')
| -rw-r--r-- | dlang/flake.nix | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/dlang/flake.nix b/dlang/flake.nix index 2ad3b1c..09dce2e 100644 --- a/dlang/flake.nix +++ b/dlang/flake.nix @@ -8,14 +8,19 @@ system = "x86_64-linux"; # adjust for aarch64-linux / darwin pkgs = import nixpkgs { inherit system; }; - /* A library, so there is nothing to install as a binary. What is - built here are the two programs that put the library to the - question: the agreement check, which loads a document's .ssp and - its .ocda.db and compares the two models, and the dump, which + /* A library, so the library itself is not a build product: a program + that uses it compiles its modules alongside its own, as the writer's + flake does, or takes it as a dub dependency. What is built here are + programs over it: the reader, and the two that put the library to + the question - the agreement check, which loads a document's .ssp + and its .ocda.db and compares the two models, and the dump, which writes a loaded model out canonically so that an implementation in another language can be diffed against this one. + + `mains` is what is compiled besides the library: the checks are one + file each in test/, the reader is src/read/. */ - mkTool = { tool, binary, what, compiler, compilerBin }: + mkTool = { tool, binary, what, mains, compiler, compilerBin }: pkgs.stdenv.mkDerivation { pname = "ocda-lib-${tool}"; version = "0.1.0"; @@ -25,7 +30,7 @@ buildPhase = '' runHook preBuild export HOME=$TMPDIR - ${compilerBin} -I=src -of=${tool} src/ocda/*.d test/${tool}.d -L-lsqlite3 -L-lzstd + ${compilerBin} -I=src -of=${tool} src/ocda/*.d ${mains} -L-lsqlite3 -L-lzstd runHook postBuild ''; installPhase = '' @@ -41,19 +46,31 @@ }; ldc = { compiler = pkgs.ldc; compilerBin = "ldmd2"; }; + + ocda-read = mkTool (ldc // { + tool = "read"; binary = "ocda-read"; mains = "src/read/*.d"; + what = "reads the abstraction in any of its forms and says what is in it"; + }); + ocda-agree = mkTool (ldc // { + tool = "agree"; binary = "ocda-agree"; mains = "test/agree.d"; + what = "checks that the .ssp and .ocda.db loaders give one model"; + }); + ocda-dump = mkTool (ldc // { + tool = "dump"; binary = "ocda-dump"; mains = "test/dump.d"; + what = "writes a loaded abstraction out canonically, as an oracle"; + }); in { packages.${system} = { - default = self.packages.${system}.ocda-agree; - - ocda-agree = mkTool (ldc // { - tool = "agree"; binary = "ocda-agree"; - what = "checks that the .ssp and .ocda.db loaders give one model"; - }); - - ocda-dump = mkTool (ldc // { - tool = "dump"; binary = "ocda-dump"; - what = "writes a loaded abstraction out canonically, as an oracle"; - }); + /* All three in one bin/, so that one build leaves every program in + one result link. Built separately into the same link, each build + replaced the one before, and a script looking for ocda-dump beside + ocda-agree found nothing. + */ + default = pkgs.symlinkJoin { + name = "ocda-lib-programs-0.1.0"; + paths = [ ocda-read ocda-agree ocda-dump ]; + }; + inherit ocda-read ocda-agree ocda-dump; }; devShells.${system}.default = pkgs.mkShell { |
