A look at pest-parser/pest: 5.4k stars on GitHub, written primarily in Rust, tracked under the Backend category. The Elegant Parser
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
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
Resource limits and timeouts for untrusted input
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
Native stack guard
With the default std feature, pest automatically checks native stack headroom
on these targets:
x86_64-unknown-linux-gnu
aarch64-unknown-linux-gnu
x86_64-apple-darwin
aarch64-apple-darwin
x86_64-pc-windows-msvc
aarch64-pc-windows-msvc
Other targets do not build stacker or psm by default. To opt into stack
checking on another target, enable stack-guard:
pest = { version = "2.9.5", features = ["stack-guard"] }
This feature enables std and requires a toolchain supported by stacker and
psm, including any required C/assembly compiler. Cross-compiling to one of the
default native targets may also require a cross C toolchain.
Stack checks are best-effort when stack bounds are unavailable; they are not
deadlines or portable stack-overflow guarantees. The cumulative
pest::set_call_limit budget works independently, including without the stack
guard. See the resource-limit guidance.
Example
The following is an example of a grammar for a list of alphanumeric identifiers
where all identifiers don't start with a digit:
alpha = { 'a'..'z' | 'A'..'Z' }
digit = { '0'..'9' }
ident = { !digit ~ (alpha | digit)+ }
ident_list = _{ ident ~ (" " ~ ident)* }
// ^
// ident_list rule is silent which means it produces no tokens
Grammars are saved in separate .pest files which are never mixed with procedural
code. This results in an always up-to-date formalization of a language that is
easy to read and maintain.
Meaningful error reporting
Based on the grammar definition, the parser also includes automatic error
reporting. For the example above, the input "123" will result in:
thread 'main' panicked at ' --> 1:1
|
1 | ab *
| ^---
|
= expected ident', src/main.rs:12
These error messages can be obtained from their default Display implementation,
e.g. panic!("{}", parser_result.unwrap_err()) or println!("{}", e).
Pairs API
The grammar can be used to derive a Parser implementation automatically.
Parsing returns an iterator of nested token pairs:
use pest_derive::Parser;
use pest::Parser;
#[derive(Parser)]
#[grammar = "ident.pest"]
struct IdentParser;
fn main() {
let pairs = IdentParser::parse(Rule::ident_list, "a1 b2").unwrap_or_else(|e| panic!("{}", e));
// Because ident_list is silent, the iterator will contain idents
for pair in pairs {
// A pair is a combination of the rule which matched and a span of input
println!("Rule: {:?}", pair.as_rule());
println!("Span: {:?}", pair.as_span());
println!("Text: {}", pair.as_str());
// A pair can be converted to an iterator of the tokens which make it up:
for inner_pair in pair.into_inner() {
match inner_pair.as_rule() {
Rule::alpha => println!("Letter: {}", inner_pair.as_str()),
Rule::digit => println!("Digit: {}", inner_pair.as_str()),
_ => unreachable!()
};
}
}
}
The current automatic Parser derivation will produce the Rule enum
which would have name conflicts if one tried to define multiple such structs
that automatically derive Parser. One possible way around it is to put each
parser struct in a separate namespace:
mod a {
#[derive(Parser)]
#[grammar = "a.pest"]
pub struct ParserA;
}
mod b {
#[derive(Parser)]
#[grammar = "b.pest"]
pub struct ParserB;
}
Other features
Precedence climbing
Input handling
Custom errors
Runs on stable Rust
Projects using pest
You can find more projects and ecosystem tools in the awesome-pest repo.
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
json5-nodes
prisma
ws2markdown (a WordStar to Markdown converter)
Minimum Supported Rust Version (MSRV)
This library should always compile with default features on Rust 1.88.0.
no_std support
The pest and pest_derive crates can be built without the Rust standard
library and target embedded environments. To do so, you need to disable
their default features. In your Cargo.toml, you can specify it as follows:
[dependencies]
# ...
pest = { version = "2", default-features = false }
pest_derive = { version = "2", default-features = false }
If you want to build these crates in the pest repository's workspace, you can
pass the --no-default-features flag to cargo and specify these crates using
the --package (-p) flag. For example:
The most recent commit recorded on pest-parser/pest was 3 days ago, based on the GitHub push timestamp. The repository has 318 forks — one of the better signals of community interest.
How many stars does pest-parser/pest have?
pest-parser/pest has 5.4k GitHub stars — refresh the page for the live number, or check github.com/pest-parser/pest. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is pest-parser/pest open source?
Yes — pest-parser/pest ships under the Apache-2.0 license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/pest-parser/pest.
What else is in the Backend space?
pest-parser/pest is tracked by TopGit under the Backend category, alongside 3 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is pest-parser/pest?
pest-parser/pest (pest-parser/pest) is a Rust project on GitHub. From the project's own README: The Elegant Parser
What language is pest-parser/pest written in?
pest-parser/pest is written primarily in Rust. GitHub's language field is based on the largest share of bytes in the default branch.
What license does pest-parser/pest use?
pest-parser/pest is released under the Apache-2.0 license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about pest-parser/pest?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/pest-parser/pest is the definitive source.
Read full README in the tab above.
Curious whether pest is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about pest.