#parser #parser-generator #peg

peginator_codegen

Buildscript support for peginator (a PEG parser generator)

4 releases (2 breaking)

0.7.0 Feb 11, 2024
0.6.0 Nov 28, 2022
0.5.1 Nov 28, 2022
0.5.0 Nov 28, 2022

#185 in Parser tooling

Download history 1/week @ 2024-06-15 1/week @ 2024-06-22 16/week @ 2024-07-13 22/week @ 2024-07-20 26/week @ 2024-07-27 9/week @ 2024-08-03 1/week @ 2024-08-10 9/week @ 2024-08-17 28/week @ 2024-08-24 24/week @ 2024-08-31 36/week @ 2024-09-07 50/week @ 2024-09-14 65/week @ 2024-09-21 16/week @ 2024-09-28

170 downloads per month
Used in 4 crates

MIT license

270KB
6.5K SLoC

Peginator codegen

Buildscript support for peginator. Please find documentation and other goodies on the main project.


lib.rs:

This crate contains the code used for generating peginator parsing code from a grammar file. Unless you are using Compile in a buildscript, you probably want to see the peginator crate documentation instead.

To integrate peginator using a buildscript, first add peginator_codegen as a build dependency in your Cargo.toml:

[build-dependencies]
peginator_codegen = "0.6"

And then in your build.rs:

use peginator_codegen::Compile;

fn main() {
    let out = format!("{}/grammar.rs", std::env::var("OUT_DIR").unwrap());

    peginator_codegen::Compile::file("grammar.ebnf")
        .destination(out)
        .format()
        .run_exit_on_error();

    println!("cargo:rerun-if-changed=grammar.ebnf");
}

See the documentation of Compile for more advanced options.

Dependencies

~0.3–10MB
~48K SLoC