Skip to content

WIP: BibTeX engine (KC-108, paused) - #91

Merged
jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/bibtex
Sep 13, 2026
Merged

jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/bibtex

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Overlap check

  • crates/bibliography (mac-bibliography / jay3332, "ready for integration") hard-codes plain/unsrt/alpha and lists ".bst interpretation in general" as unsupported. No .bst interpreter exists on main or on any bib|cite|natbib branch (daniel-parent/cite = manual thebibliography only). This PR adds a separate crate, crates/bibtex-bst, and changes nothing outside it.

Done (commit 08baeac)

  • crates/bibtex-bst/Cargo.toml (edition 2024, zero dependencies).
  • src/chars.rs: lex_class/id_class (bibtex.web §§31–33 plus bibtex.ch [32]/[33]: bytes 128–255 are alpha, CR is whitespace), the cmr10 char_width table (§35), and the 13 control sequences.
  • tests/data/bib/*.bib: six fixture databases (people/von/Jr/corporate names, @string/#/@preamble/line breaking, crossref with min_crossrefs and nested/bad refs, accents/change.case/alpha labels, error cases, a sort-heavy large database).
  • tests/data/bst/: unmodified TeX Live 2026 copies of plain, unsrt, alpha, abbrv, acm, ieeetr, siam, apalike, plainnat, abbrvnat, unsrtnat (licenses allow unmodified redistribution / LPPL).

Not done

  • The crate does not build yet: src/lib.rs and the engine modules are not written.
  • No oracle expectations yet: the generator is not written and bibtex has not been run. Oracle status is 0 of 0.
  • CONTRACT.md is not written.

Verified facts for resuming

  • Source studied: TeX Live texk/web2c/bibtex.web + bibtex.ch.
  • MacTeX oracle is BibTeX 0.99e.
  • Runtime values: max_print_line=79, ent_str_size=500, glob_str_size=200000, min_crossrefs=2 (kpsewhich -progname=bibtex).
  • The .blg also contains a banner, a Capacity: line and a built-in call-count block. The oracle should compare the .blg with those removed.

Next steps to resume

  1. Engine modules, as a faithful port with Result<_, Stop{Return,BstDone,AuxDone,Fatal}> for bibtex.web's non-local exits:
    • engine.rs: log/history, line Buf/input_ln (eoln at \n or \r), aux reading with the §§108–156 messages.
    • bst.rs: §§170–216 commands and scan_fn_def, with the error-return scope per procedure.
    • bib.rs: §§217–294 .bib scanning, cite_list/crossref/min_crossrefs, missing/duplicate warnings.
    • exec.rs: §§295–342 stack, sort, 79-column add_out_pool, and all 37 built-ins (§§343–463). Persistent globals are brace_level, prev_colon and name_sep_char. Apply bibtex.ch [388], which removes the leading-junk loop in format.name$.
    • lib.rs: run(aux, &dyn FileSource, &Options) -> Output{bbl, blg, history, messages}, DirSource, and a Session that memoises by file contents.
  2. tests/oracle/generate.py: write about 71 cases (11 styles × 5 databases, the errors database × 4 styles, plus nocite{*}, case mismatch, multiple bibs, \@input, missing style/bib, no citations, repeated \bibdata). Run bibtex with BSTINPUTS/BIBINPUTS pointing at tests/data and commit tests/data/expected/*.{bbl,blg}.
  3. tests/oracle.rs: compare .bbl bytes and the normalised .blg without running bibtex, and print the pass counts.
  4. CONTRACT.md: the adoption proposal for crates/compiler and crates/bibliography.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

…8, paused)

New crate crates/bibtex-bst (not yet buildable: src/lib.rs and engine
modules not written). Contains the bibtex.web character classes and cmr10
width table, six tricky .bib fixture databases, and unmodified copies of
the 11 TeX Live styles used as oracle inputs. No expected outputs yet.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-108, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar

GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by draft #97 (branch agent/kabir-claude/bibtex-r2): working engine, 95 TeX Live oracle cases, .bbl 95/95 byte-identical. Leaving #91 open.

@jay3332
jay3332 merged commit 08baeac into main Sep 13, 2026
14 of 18 checks passed
@GoKubar
GoKubar deleted the agent/kabir-claude/bibtex branch September 13, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants