Skip to content
Merged
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/Dsp.g4
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ term
: SYMBOL # symbol
| '(' term ')' # parentheses
| term '::' term # binary
| term '.' term # binary
| term ('.' | '->') term # binary

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

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

The examples in the PR description suggest that p -> q . y should parse as p -> (q . y) (right-associative), but the grammar implementation makes both . and -> left-associative by default in ANTLR4. This means p -> q . y will actually parse as (p -> q) . y. If right-associativity is intended for these operators, they would need separate grammar rules or explicit associativity directives. Please verify the expected associativity behavior and update the PR description examples if needed.

Suggested change
| term ('.' | '->') term # binary
| <assoc=right> term ('.' | '->') term # binary

Copilot uses AI. Check for mistakes.

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

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

The new -> operator lacks test coverage. Given that comprehensive tests exist for other operators (binary, unary, subscript, function), tests should be added for the -> operator to verify parsing and unparsing behavior, especially its precedence relationship with . operator. Consider adding tests similar to test_parse_binary_operator and test_unparse_binary_operator that specifically test the -> operator.

Copilot uses AI. Check for mistakes.
| term '[' term (',' term)* ']' # subscript
| term '(' (term (',' term)*)? ')' # function
| <assoc=right> ('~' | '!' | '-' | '+' | '&' | '*') term # unary
Expand Down