Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bnf/apyds_bnf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def visitRule_pool(self, ctx):
def visitRule(self, ctx):
result = [self.visit(t) for t in ctx.term()]
if len(result) == 1:
return f"----\n{result[0]}"
return f"----\n{result[0]}\n"
else:
conclusion = result.pop()
length = max(len(premise) for premise in result)
Expand Down
2 changes: 1 addition & 1 deletion bnf/atsds_bnf/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ParseVisitor extends DspVisitor {
visitRule(ctx) {
const result = ctx.term().map((t) => this.visit(t));
if (result.length === 1) {
return `----\n${result[0]}`;
return `----\n${result[0]}\n`;
} else {
const conclusion = result.pop();
const length = Math.max(...result.map((premise) => premise.length));
Expand Down
4 changes: 2 additions & 2 deletions bnf/tests/test_parse_unparse.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test("parse_no_premises", () => {
// Test parsing a rule with no premises (axiom)
const dsp_input = "a";
const ds_output = parse(dsp_input);
const expected = "----\na";
const expected = "----\na\n";
expect(ds_output).toBe(expected);
});

Expand Down Expand Up @@ -74,7 +74,7 @@ test("unparse_simple_rule", () => {

test("unparse_no_premises", () => {
// Test unparsing a rule with no premises
const ds_input = "----\na";
const ds_input = "----\na\n";
const dsp_output = unparse(ds_input);
const expected = " -> a";
expect(dsp_output).toBe(expected);
Expand Down
4 changes: 2 additions & 2 deletions bnf/tests/test_parse_unparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_parse_no_premises() -> None:
"""Test parsing a rule with no premises (axiom)"""
dsp_input = "a"
ds_output = parse(dsp_input)
expected = "----\na"
expected = "----\na\n"
assert ds_output == expected


Expand Down Expand Up @@ -76,7 +76,7 @@ def test_unparse_simple_rule() -> None:

def test_unparse_no_premises() -> None:
"""Test unparsing a rule with no premises"""
ds_input = "----\na"
ds_input = "----\na\n"
dsp_output = unparse(ds_input)
expected = " -> a"
assert dsp_output == expected
Expand Down
2 changes: 1 addition & 1 deletion docs/support-packages/bnf.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For structured terms:
| Description | Dsp Format | Ds Format |
|-------------|------------|-----------|
| Simple rule | `a, b -> c` | `a\nb\n----\nc` |
| Axiom | `a` | `----\na` |
| Axiom | `a` | `----\na\n` |

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The axiom format in the bnf/README.md file also needs to be updated to match this change. Line 119 of bnf/README.md still shows ----\na instead of ----\na\n.

Copilot uses AI. Check for mistakes.
| Function call | `f(a, b) -> c` | `(function f a b)\n----------------\nc` |
| Subscript | `a[i, j] -> b` | `(subscript a i j)\n-----------------\nb` |
| Binary operator | `(a + b) -> c` | `(binary + a b)\n--------------\nc` |
Expand Down