flatparse icon indicating copy to clipboard operation
flatparse copied to clipboard

Include batteries

Open AndrasKovacs opened this issue 2 years ago • 0 comments

The idea is to have a TH-configurable interface that covers a lot of needed features in PL parsing. The inputs could be the following:

  • Identifier parsing: first character, rest of characters.
  • Whitespace characters.
  • Comments, line/multiline, nestedness.
  • List of keywords.
  • Type of errors, rendering possibly custom or configurable.

Output:

  • Identifier parser, keyword parser, whitespace parser, token combinator.
  • Functions for error handling.
  • switch function that automatically handles keyword/identifier disambiguation and tokenization. For example, if I switch on "let", I don't want to manually cover the case where we actually have an identifier that has "let" as prefix. This should be handled at compile time, by using the user-provided functions for identifier/keyword parsing. The source spans of switched things should be also made accessible in a concise way.

There could be two flavors of batteries, one for Basic without indentation tracking an another for Stateful with it. There should be at least a larger PL benchmark too that uses our batteries. That could also serve as tutorial.

I'm interested in suggestions about what kind of features could be included in the batteries.

AndrasKovacs avatar Sep 24 '23 11:09 AndrasKovacs