1. 21
  1.  

  2. 10

    I will start with a function that takes a string as input and tells you if the input passes some test you’ve set out for it. This is not yet a parser, not really.

    This is called a recogniser in the literature; basically a parser that doesn’t build up a parse tree but can recognise whether an input is grammatically valid.

    1. 1

      Thanks, that is a word I was lacking.

    2. 3

      really enjoyed the post!

      This is the first parser combinator example that really clicked

      My only issue with parser combinator is almost definitely due to lack of experience but they seem a bit difficult to debug & comprehend. Though i dont think its inherent to them, just that people tend to write them as terse expression based functions vs a little bit of imperative logic which could leave room for a debugger statement

      This actually gives me an idea of how to write combinators in semi imperative js

      1. 2

        thanks that really makes me happy :)

      2. 1

        It reminds me a lot of LPEG.

        1. 1

          LPEG is basically a parser combinator library.