Parsel: a next-generation parsing library
If you have ever worked with parser generators or parsing libraries, you probably
encountered some or all of the following problems:
- When using a parser generator, you needed to run a separate external executable,
complicating your build process. You also needed to provide "parser actions" to
manually construct AST nodes based on each individual production of the grammar.
- When using a parser combinator library, you still had to manually map the low-level
parse trees returned by the combinator functions into high-level AST node types that
you wanted to represent your grammar with.
- You had to manually keep track of the source location of each production, and add
it to the corresponding AST node.
- The grammar required maintenance in two parallel places: changing the syntax
required changing a production in the parser, as well as updating the representation
of the AST types to match the new syntax.
- While parsing was adequately implemented by the tool or library you used, the
reverse direction (serializing an AST as source code) was missing or poorly supported.
Parsel is a next-generation parsing library that solves all of these
problems at once. Inspired by the Serde serialization framework, it provides
procedural macros and a battery of AST helper types, which allow you to directly parse
source code into AST nodes.
No more manual mapping of productions to AST types. No more running of external binaries.
No more manual walking of ASTs. No more worrying about operator precedence.
To get started, see the official documentation.
To contribute, star and fork the project on GitHub.