Skip to content
@pest-parser

pest

The Elegant Parser

pest. The Elegant Parser

Join the chat at https://gitter.im/pest-parser/pest Book Docs

pest Continuous Integration codecov Rustc Version 1.56.1+

Crates.io Crates.io

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:

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 two repositories:

  • book contains the source code for building the book on pest.rs.
  • site contains the source code for bundling the book with the rest of the website source code (both the playground and the homepage)

There are two tooling-related pest crates:

  • pest-fmt can help to format pest grammars (try it online).
  • 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).
  • tree-sitter-pest Pest grammar for the tree-sitter.

There are editor plugins for pest:

  • pest.vim can do syntax highlighting of pest grammars in Vim.
  • intellij-pest can do syntax highlighting, 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.
  • vscode-pest Pest support for VS Code, via the LSP.
  • zed-pest Pest support for Zed.

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

You can find more projects and ecosystem tools in the awesome-pest repo.

Pinned

  1. pest pest Public

    The Elegant Parser

    Rust 4.4k 249

  2. book book Public

    pest book

    JavaScript 42 30

  3. site site Public

    This repo contains the source code for https://pest.rs

    CSS 11 12

Repositories

Showing 10 of 15 repositories