Skip to content

m-schm/chumsky

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chumsky

crates.io crates.io License actions-badge

A friendly parser combinator crate that makes writing LL(1) parsers with error recovery easy.

Example

Here follows a Brainfuck parser. See examples/ for the full interpreter.

fn parser() -> impl Parser<char, Vec<Instr>, Error = Simple<char>> {
    use Instr::*;
    recursive(|bf| bf.delimited_by('[', ']').map(|xs| xs.map_or(Invalid, Loop))
        .or(just('<').to(Left))
        .or(just('>').to(Right))
        .or(just('+').to(Incr))
        .or(just('-').to(Decr))
        .or(just(',').to(Read))
        .or(just('.').to(Write))
        .repeated())
}

Other examples in this repository include a JSON parser, a Brainfuck interpreter, and an interpreter for a simple dynamically-typed Rust-like programming language.

Features

  • Generic combinator parsing
  • Error recovery
  • Recursive parsers
  • Text-specific parsers & utilities
  • Custom error types

Planned Features

  • Nested parsers (parsers that parse patterns within nested tokens)

Other Information

My apologies to Noam for choosing such an absurd name.

License

Chumsky is licensed under the MIT license (see LICENSE) in the main repository.

About

A friendly parser combinator crate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%