Declaring literal syntax kind as keyword breaks precedence parsing
Open
Nobody has claimed this yet.
bug
P-low
parser
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
When indexing the parser tables with the next token (ignoring extended identifier behavior for this issue), we do one of two things:
- If the next token is an naked atom
s(i.e. a symbol or keyword), we usesas the index - If the next token is a node (i.e. a literal) of kind
k, we usekas the index
These two categories are reasonably disjoint in Lean code, but that is unfortunately not true for embedded languages!
import Lean
declare_syntax_cat cat
syntax char : cat
syntax "char" : cat
elab "test" c:cat : command =>
IO.println c
-- (choice (catChar "char") (cat_ "char"))
test char
Here the keyword char and the literal kind charKind = `char overlap
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the embedded-language example in the issue and inspect how parser tables index an atom versus a literal node. The issue provides no file or test entry point; done means the char keyword and literal kind no longer overlap in a way that breaks precedence parsing.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100