3 ms·
My go-to library for parsing in Python is https://github.com/pyparsing/pyparsing https://github.com/pyparsing/pyparsing, a https://en.wikipedia.org/wiki/Parsing
by RiversHaveWings 7y ago
My go-to library for parsing in Python is https://github.com/pyparsing/pyparsing https://github.com/pyparsing/pyparsing, a https://en.wikipedia.org/wiki/Parsing_expression_grammar https://en.wikipedia.org/wiki/Parsing_expression_grammar -based https://en.wikipedia.org/wiki/Parser_combinator https://en.wikipedia.org/wiki/Parser_combinator library. I generally find it much easier to get my head around parser combinators than parser generators.
- vorg 7y agoAs the author says: > because the parser generator knows about all patterns you want to match in advance, it will match longer terminals before shorter—more ambiguous—terminals If you don't mind manually ordering your choices in your alt operators, then PEG and parser combinators are OK. Oh, and you often need to restructure your grammar to avoid left recursion.