Repository navigation
tex-expansion: TeX/e-TeX/LaTeX macro expansion engine (KC-101) - #88
Merged
Merged
Conversation
New crate crates/tex-expansion implementing catcodes+tokenizer, def/edef/gdef/xdef/let/futurelet, expandafter/noexpand/csname, TeX and e-TeX conditionals (if/ifx/ifnum/ifdim/ifodd/ifcase/newif/unless), grouping with global/aftergroup, count/dimen/skip/toks registers with countdef family and numexpr/dimexpr, and a LaTeX layer (newcommand/renewcommand/provide, newenvironment, counters, @ifnextchar/@ifstar/@namedef/@nameuse). 45 unit tests passing. Implementation-Agent: Claude Fable 5.1 (subagent kabir-claude KC-101, mac-m5pro-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Fable 5.1 <[email protected]>
…orpus
Fixes found via a 108-case oracle corpus run against real tex/etex/pdflatex:
bare grouping braces must not appear in the content-token stream (matches
real main-control semantics, not \write's scan_toks semantics); \the\dimen
must render via TeX's print_scaled algorithm, not raw sp; \numexpr division
rounds to nearest (ties away from zero); \ifcase must keep skipping on a
negative selector; \setcounter/\addtocounter values may contain expandable
constructs like \value{...}; \count's "..." hex parsing.
Adds tests/oracle/ (generator script + committed manifest.json + expected
fixtures, gitignored tmp/) and CONTRACT.md proposing the crates/compiler
adoption path, known deviations from real TeX, and what's done vs not.
47 unit tests + 108/108 oracle cases green.
Implementation-Agent: Claude Fable 5.1 (subagent kabir-claude KC-101, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This was referenced Sep 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/tex-expansion(not yet wired intocrates/compiler— seeCONTRACT.mdfor the proposed adoption diff and ownership boundaries).\def/\edef/\gdef/\xdefwith delimited/#{/undelimited params,\let/\futurelet,\expandafter/\noexpand/\csname, all TeX+e-TeX conditionals (\if*,\ifcase,\newif,\unless),\count/\dimen/\skip/\toksregisters + arithmetic +\numexpr/\dimexpr, and a LaTeX layer (\newcommand/\newenvironment/counters/\@ifnextchar/\@ifstar/\@namedef/\@nameuse).tests/oracle/gen/cases.pydrives realtex/etex/pdflatex(MacTeX) to capture ground truth for 108 cases, committed astests/oracle/manifest.json;cargo testnever invokes TeX itself.Test plan
cargo test(47 unit + 2 oracle-suite tests covering 108 cases) greencrates/compilerperCONTRACT.md(owned by another agent/PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu