Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

The BNF conversion library (/bnf) lacked proper documentation. Users couldn't discover or understand how to use the bidirectional syntax conversion between Ds (S-expression) and Dsp (human-readable) formats.

Changes

  • /bnf/README.md: Created concise documentation (196 lines) following main README structure

    • Installation instructions for both apyds-bnf (Python) and atsds-bnf (JavaScript)
    • Quick start examples demonstrating parse() and unparse() functions
    • Syntax comparison table showing bidirectional conversions
    • Build instructions for both Python and JavaScript packages
    • Grammar files documentation
  • /README.md: Added "Support Packages" section

    • Single-line entry listing BNF conversion library packages with PyPI/npm links
    • Link to /bnf directory for details

Example

from apyds_bnf import parse, unparse

# Human-readable → S-expression
parse("a, b -> c")  # Returns: "a\nb\n----\nc"

# S-expression → Human-readable  
unparse("a\nb\n----\nc")  # Returns: "a, b -> c"

All examples validated against test suite (/bnf/tests/test_parse_unparse.{py,mjs}).

Original prompt

This section details on the original issue you should resolve

<issue_title>需要模仿/README.md 和 /bnf/tests 内的内容, 写一个更好的 /bnf/README.md , 同时需要在/README.md 加上一个section, 列一下support packages, 然后指出目前/bnf下有个辅助的库.</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update /bnf/README.md and add support packages section Add comprehensive BNF package documentation and support packages section Dec 9, 2025
Copilot AI requested a review from hzhangxyz December 9, 2025 08:37
Copy link
Member

@hzhangxyz hzhangxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. /README.md 下面 support packages 写一个行就行了, 给个作用和链接就行.
  2. API Reference 这个section可以删除, 前面的足够了
  3. Examples这个section也可以删除, 前面的足够了
  4. Testing 这个section也要删除, 完全是多余的
  5. Development 这个section也删除

…n and remove API Reference, Examples, Testing, and Development sections

Co-authored-by: hzhangxyz <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 9, 2025

  1. /README.md 下面 support packages 写一个行就行了, 给个作用和链接就行.
  2. API Reference 这个section可以删除, 前面的足够了
  3. Examples这个section也可以删除, 前面...

All requested changes completed in 7e1ef15:

  1. Support Packages section in /README.md simplified to single line with links
  2. Removed API Reference section from /bnf/README.md
  3. Removed Examples section from /bnf/README.md
  4. Removed Testing section from /bnf/README.md
  5. Removed Development section from /bnf/README.md

The BNF README is now more concise (196 lines vs 375), keeping only essential sections: Features, Installation, Quick Start, Syntax Formats, Building from Source, and Grammar Files.

Copilot AI changed the title Add comprehensive BNF package documentation and support packages section Add BNF package documentation and support packages section Dec 9, 2025
Copilot AI requested a review from hzhangxyz December 9, 2025 08:43
@hzhangxyz hzhangxyz marked this pull request as ready for review December 9, 2025 09:19
Copilot AI review requested due to automatic review settings December 9, 2025 09:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds comprehensive documentation for the BNF conversion library, making it discoverable and usable as a standalone support package for the DS deductive system. The documentation enables users to understand and use the bidirectional syntax conversion between Ds (S-expression) and Dsp (human-readable) formats.

Key changes:

  • Created detailed documentation for the /bnf package with installation, usage examples, and syntax reference
  • Added "Support Packages" section to main README linking to the BNF conversion library packages
  • Provided validated examples matching the test suite for both Python and JavaScript implementations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
bnf/README.md Comprehensive package documentation including installation instructions, quick start examples, syntax comparison table, build instructions, and links to PyPI/npm packages
README.md Added "Support Packages" section listing the BNF conversion library with links to apyds-bnf (PyPI) and atsds-bnf (npm) packages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| Binary operator | `(a + b) -> c` | `(binary + a b)\n--------------\nc` |
| Unary operator (parse input) | `~ a -> b` | `(unary ~ a)\n-----------\nb` |
| Unary operator (unparse output) | `(~ a) -> b` | `(unary ~ a)\n-----------\nb` |
| Complex expression | `((a + b) * c), d[i] -> f(g, h)` | `(binary * (binary + a b) c)\n(subscript d i)\n---------------------------\n(function f g h)` |
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dsp format for the complex expression in the parse input should be (a + b) * c, d[i] -> f(g, h) (with single parentheses around a + b), not ((a + b) * c), d[i] -> f(g, h) (with double parentheses). The double parentheses are only added during unparsing for operator precedence. The current row incorrectly shows the unparsed output format for both input and output.

This should be split into two rows or clarified:

  • Parse input: (a + b) * c, d[i] -> f(g, h)
  • Unparse output: ((a + b) * c), d[i] -> f(g, h)

Reference: tests/test_parse_unparse.py lines 62 and 128.

Suggested change
| Complex expression | `((a + b) * c), d[i] -> f(g, h)` | `(binary * (binary + a b) c)\n(subscript d i)\n---------------------------\n(function f g h)` |
| Complex expression (parse input) | `(a + b) * c, d[i] -> f(g, h)` | `(binary * (binary + a b) c)\n(subscript d i)\n---------------------------\n(function f g h)` |
| Complex expression (unparse output) | `((a + b) * c), d[i] -> f(g, h)` | `(binary * (binary + a b) c)\n(subscript d i)\n---------------------------\n(function f g h)` |

Copilot uses AI. Check for mistakes.
@hzhangxyz hzhangxyz merged commit cefbde4 into main Dec 9, 2025
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants