Total Parser Combinators - Agdarsec
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 91
- Forks
- 3
- Avg merge
- 13d 22h
- Merged PRs (30d)
- 1
Description
Problem
Currently all our parsers terminate, but this is done by a check at runtime:
It'd be much better for this to not be possible at compile time
Research
I've found this paper on agdarsec (https://github.com/gallais/agdarsec/). A parser combinator library for Agda, which has "total parser combinators", that is parsers combinators that always terminate.
To do that it adds constraints and tradeoffs:
- For a parser to be successful, it must consume some of its input
- Failure is implemented by always returning the empty result list.
- Several combinators are incompatible, like
many,sepby, etc. Essentially all the ones that succeed on zero or more occurrences. eofis not representable by agdarsec- There is no
pureparser (since it succeeds but doesn't have to consume input)
Some breaking changes might be acceptable but one thing I'm not sure is it's expressive enough. I haven't found many examples.
Contributor guide
No contributing guide indexed for this repository
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 with the runtime termination check in cparsec.h at lines 164–166, then read the linked agdarsec paper and compare its constraints with the existing parser combinators. Determine whether a total design remains expressive enough, including the listed incompatible combinators and breaking changes. Done means documenting a concrete design direction and its tradeoffs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100