Resources for writing a parser/lexer

You may find Lerche useful. It reads an EBNF for your grammar to create a parser. Rules provided by you for traversing and transforming the resultant parse tree are then applied. Lerche is only version 0.1 but the API is designed to match the Lark API so it shouldn’t change.

I am successfully using it for a reasonably complicated grammar .

There are certainly opportunities for speed improvement in Lerche. As a workaround, you can see from the linked project that it is possible to simply serialise the generated parser.

1 Like