trampoline-parser 0.1.1

DSL for generating trampoline-based scannerless parsers
Documentation
  • Coverage
  • 74.46%
    242 out of 325 items documented1 out of 39 items with examples
  • Size
  • Source code size: 272.11 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 18.2 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 20s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DmitryBochkarev

Trampoline Parser Generator

A DSL for generating fully trampoline-based scannerless parsers.

Example

use trampoline_parser::Grammar;

let grammar = Grammar::new()
    .rule("number", |r| {
        r.capture(r.one_or_more(r.digit()))
    })
    .rule("expr", |r| {
        r.sequence((
            r.parse("number"),
            r.lit("+"),
            r.parse("number"),
        ))
    })
    .build();

let code = grammar.generate();