Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Total Parser Combinators - Agdarsec

Open
#7 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
c
Domain
compilers

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.

Description

Problem

Currently all our parsers terminate, but this is done by a check at runtime:

https://github.com/steve-chavez/CParseC/blob/2ec0da5107febbef3b1ffce02f842a24a8542a5d/cparsec.h#L164-L166

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.
  • eof is not representable by agdarsec
  • There is no pure parser (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.

Dominant language
C
Stars
92
Forks
3
Avg merge
55m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PostgREST/CParseC

All issues in PostgREST/CParseC

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.