Skip to content

Can we have more typesafety w.r.t. many-like combinators and infinite loops? #120

Closed
@chtenb

Description

@chtenb

Is your change request related to a problem? Please describe.
many p will get stuck in a loop if p possibly doesn't consume any input but still succeeds.

One could argue that the parser is bogus in that case. However, it would be nice to have some compile time safety guarantees for this, because a hanging application isn't fun to deal with, even if it occurs while developing.

Some solution directions that cross my mind

  • Utilizing the typesystem in some way that makes it impossible to pass a parser that possibly consumes no input but still succeeds.
  • Changing the semantics of many such that it stops (or fails?) whenever the position of the parser state hasn't moved after applying p.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions