More robust handling of prefixes
- Dominant language
- Rust
- Stars
- 289
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Currently prefixes can be used as follows:
```
@prefix prefix: .
fact(prefix:constant).
```
This syntax may create ambiguity in certain cases. For example, when allowing '-' within prefixes, it may create confusion with the infix operator for subtraction. I.e. in the program
```
@prefix my-prefix: .
result(my-prefix:constant) : body(?x) .
```
`my-prefix:constant` can be interpreted as the constant `https://www.example.com/constant` or as the subtraction of the constants `my` and `prefix:constant`. Currently, `-` is disallowed from prefix names for that reason.
Another problem occurs when considering a more natural map syntax that separates keys from values through `:`. Such cases can create confusion, e.g. consider `map { a:b:c }` which can either be the mapping of `a` to `b:c` or `a:b` to `c`.
A possible solution to this would be to include the currently known prefixes in the parser state so that it can be matched before other syntactic constructs are evaluated.
Contributor guide
Research direction
Start with the parser state and prefix-handling behavior described in the issue. Work out how known prefixes should be matched before subtraction and other syntax, while resolving the ambiguity in map expressions such as `map { a:b:c }`. The issue does not identify a file or test, so the parsing entry point and completion checks still need to be located.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100