How parsers work (in practise)?

Hand-written [...] parsers can trivially do [whatever] and ... give a useful error message ... Of course with arbitrarily complicated grammars that's not doable

Never say never...


  • Grammars are analytic, and such that grammars and parsers are the same thing; and
  • The formalism makes it easy and productive for mere mortals to read, write, and maintain grammars/parsers of arbitrary complexity while intuitively avoiding turing's tarpits (space and time); and
  • Provide expected conveniences for abstraction of facets such as error message construction, and zero overhead construction of subsequent compilation phases;

Then the classic disconnect is resolved and by definition grammars/parsers are guaranteed to be:

  • In sync;
  • Capable of being as good as can be specified by any turing complete language.

cf the section What are Raku Rules / grammars? of my StackOverflow answer to What's the real difference between a token and a rule?

/r/ProgrammingLanguages Thread Parent