pest. The Elegant Parser
pest is a general purpose parser written in Rust with a focus on accessibility, correctness, and performance. It uses parsing expression grammars (or PEG) as input, which are similar in spirit to regular expressions, but which offer the enhanced expressivity needed to parse complex languages.
Getting started
The recommended way to start parsing with pest is to read the official book.
Other helpful resources:
- API reference on docs.rs
- play with grammars and share them on our fiddle
- find previous common questions answered or ask questions on GitHub Discussions
- leave feedback, ask questions, or greet us on Gitter or Discord
Repositories
The pest-parser GitHub organization hosts several repositories. The main one is naturally pest where you can find the source code of main pest-related crates.
The pest.rs website is spanned across three repositories:
- pest-parser.github.io hosts the built static website using GitHub Pages.
- book contains the source code for building the book on pest.rs.
- site contains the source code of the fiddle editor on pest.rs.
There are two tooling-related pest crates:
- pest-fmt can help to format pest grammars (you can try it in this cool online version).
- ast can help to reduce boilerplate when converting pest parse trees to abstract syntax trees (BTW the pest_consume crate can also help with the parse tree traversing boilerplate).
There are two editor plugins for pest:
- pest.vim can do syntax highlighting of pest grammars in Vim.
- intellij-pest can do syntax higlighting, completion, refactoring (renaming, extracting rules, inlining) in IntelliJ editors, such as IDEA or CLion, of pest grammars in both external files and in ones embedded in Rust.
Finally, pest3 contains an unfinished effort of pest 3.0 that is stalled for now. You can follow the future progress on this milestone here: feel free to comment on its issues or open a discussion thread.
Projects using pest
- pest_meta (bootstrapped)
- AshPaper
- brain
- cicada
- comrak
- elastic-rs
- graphql-parser
- handlebars-rust
- hexdino
- Huia
- insta
- jql
- json5-rs
- mt940
- Myoxine
- py_literal
- rouler
- RuSh
- rs_pbrt
- stache
- tera
- ui_gen
- ukhasnet-parser
- ZoKrates
- Vector
- AutoCorrect
- yaml-peg
- qubit
- caith (a dice roller crate)
- Melody