#peg #grammar #parser

nameless-peg-parser

An implementation of PEG, still unstable

3 releases

0.1.2 Jul 7, 2024
0.1.1 Jul 7, 2024
0.1.0 Jul 7, 2024

#92 in Parser tooling

27 downloads per month

MIT license

55KB
1K SLoC

Nameless PEG Parser

This is an implementation of https://bford.info/pub/lang/peg.pdf

I implemented it mostly out of academic curiosity and it is not optimized in any way shape or form.

There are two examples included in the examples folder, one for success, one for failure.

The parser logs to debug! and error! or the log module, if you want to see some logs, include your logging implementation and enable the appropriate log level. The examples include env_logger and logging can be enabled by setting the env variable "RUST_LOG=debug".

Usage:

let parser = PEG::from_grammar(start_rule, grammar_string)?;
let result = parser.parse(input_string);

Feel free to make PRs :), I will most likely continue tinkering with it and maybe even properly optimize it.

YT: https://www.youtube.com/watch?v=awtHSLEIFxA

Can be found as a crate: https://docs.rs/nameless-peg-parser/latest/nameless_peg_parser/index.html

Dependencies

~86KB