#parser #grammar #ast #peg

peginator_codegen

Buildscript support for peginator (a PEG parser generator)

3 unstable releases

0.6.0 Nov 28, 2022
0.5.1 Nov 28, 2022
0.5.0 Nov 28, 2022

#233 in Parser tooling

Download history 19/week @ 2023-07-28 23/week @ 2023-08-04 23/week @ 2023-08-11 27/week @ 2023-08-18 17/week @ 2023-08-25 16/week @ 2023-09-01 29/week @ 2023-09-08 26/week @ 2023-09-15 14/week @ 2023-09-22 26/week @ 2023-09-29 29/week @ 2023-10-06 27/week @ 2023-10-13 23/week @ 2023-10-20 32/week @ 2023-10-27 29/week @ 2023-11-03 27/week @ 2023-11-10

116 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.4–8.5MB
~81K SLoC