docs: add English docstrings and SLR(1) algorithm comments (T0)#34
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add module-level docstring explaining the SLR(1) construction pipeline, class-level docstrings for all public and internal types (EOS, EPSILON, Maker variants, StartVariable, Item, State, action types, Table, Rule, Parser), and block comments on the five phases of Parser.__init__ and on the key algorithm routines (closure, goto, calc_first, calc_follow, parse) stating the SLR(1) invariants and the over-approximation that T6 will fix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter PYTHON_BLACK |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter PYTHON_BLACK |
Super-linter summary
Super-linter detected linting errors For more information, see the GitHub Actions workflow run Powered by Super-linter PYTHON_BLACK |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
henrylee97
enabled auto-merge (squash)
May 4, 2026 08:34
Pytest ReportTest Results
Comment by ✨sambyeol/publish-pytest-action |
Pytest ReportTest Results
Comment by ✨sambyeol/publish-pytest-action |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
henrylee97
added a commit
that referenced
this pull request
May 11, 2026
## Summary - Fix hash semantics for `Item`, `State`, and `Token` to be value-based and class-aware - Replace recursive FIRST/FOLLOW computation with worklist fixed-point algorithms, fixing incorrect results on mutually recursive grammars - Make LR(0) state construction deterministic across repeated `Parser` instantiations - Add English docstrings and SLR(1) algorithm comments throughout the codebase - Expand test coverage with 4 new test modules (safety-net, FIRST/FOLLOW, determinism, hash semantics) ## Changes ### Bug Fixes - Correct hash implementations for `Item`, `State`, `Token` (#38) - Fixed-point FIRST / FOLLOW computation replacing re-entry-guard recursion (#36) ### Improvements - Deterministic LR(0) state construction (#37) ### Documentation - English docstrings and SLR(1) inline algorithm comments (#34) ### Tests - Parser safety-net suite, FIRST/FOLLOW unit tests, determinism tests, hash semantics tests (#35 #36 #37 #38) ### Maintenance - Bumped GitHub Actions: `actions/checkout` 4→6, `actions/setup-python` 5→6, `sambyeol/publish-pytest-action` 2→4, `super-linter/super-linter` 7→8 (#28 #29 #31 #32 #33) ## Test plan - [x] `pytest -q` passes (`29 passed, 2 xfailed`) - [x] `python examples/calc/calc.py examples/calc/data/ex01.calc` prints `2` Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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
plare/*.pyfilesToken,Lexer,Parser,Rule,Item,State, action types, etc.)Parser.__init__and onclosure,goto,calc_first,calc_follow, andParser.parsestating this is SLR(1), the invariants each routine relies on, and the over-approximation that T6 will fixNo logic changes —
git diff --statshows additions in docstrings and comments only.Checklist
pytest -qgreen (8 passed)HANDOFF.mdT0 marked as DONE