#parser #combinators #ll


**DEPRECEATED** Parser combinators based on the Haskell library parsec. This library has been renamed to combine. See https://crates.io/crates/combine for more recent versions **DEPRECEATED**

19 releases

Uses old Rust 2015

0.7.1 Apr 12, 2017
0.7.0 Jul 17, 2015
0.6.0 Jul 9, 2015
0.2.5 Mar 27, 2015

#96 in Parser tooling

Download history 19/week @ 2022-12-06 33/week @ 2022-12-13 16/week @ 2022-12-20 11/week @ 2022-12-27 4/week @ 2023-01-03 10/week @ 2023-01-10 7/week @ 2023-01-17 21/week @ 2023-01-24 25/week @ 2023-01-31 35/week @ 2023-02-07 64/week @ 2023-02-14 30/week @ 2023-02-21 9/week @ 2023-02-28 10/week @ 2023-03-07 47/week @ 2023-03-14 5/week @ 2023-03-21

71 downloads per month
Used in 2 crates (via seax_scheme)

MIT license

1.5K SLoC

parser-combinators Build Status

An implementation of parser combinators for Rust, inspired by the Haskell library Parsec. As in Parsec the parsers are LL(1) by default but they can opt-in to arbitrary lookahed using the try combinator.

A parser combinators is, broadly speaking, a function which takes several parsers as arguments and returns a new parser, created by combining those parsers. For instance, the many parser takes one parser, p, as input and returns a new parser which applies p zero or more times.

The library is mostly stable but a few parts of the internals may still change. If you end up trying it I welcome any feedback from your experience with it.


extern crate parser_combinators;
use parser_combinators::{many, Parser};
use parser_combinators::char::letter;

let result = many(letter()).parse("hello world");
assert_eq!(result, Ok(("hello".to_string(), " world")));

Documentation and examples



There is an additional crate which has parsers to lex and parse programming languages in parser-combinators-language.

Breaking changes

Here is a list containing most of the breaking changes in older versions of parser-combinators.


  • Stream::uncons changed its signature to allow it to return errors. Return Error::end_of_input() instead of () if you implemented Stream.


  • Addition of Parser::parse_lazy, should not break anything but I can't say for certain.


  • any_char -> any, uncons_char -> uncons
  • Introduction of the Positioner trait which needs to be implemented on an custom token types.
  • satisfy is moved to the combinators module and made generic, might cause type inference issues.


  • any_char is no longer a free function but returns a parser when called as all parser functions (and its called any after 0.5.0)
  • Cow is replaced by Info in the error messages.

0.3.2 / 0.3.0

  • Added variant to Error which can hold any kind of ::std::error::Error
  • choice_vec and choice_slice is replaced by just choice


  • Iterators cannot directly be used as streams but must be wrapped using from_iter function

If you have trouble updating to a newer version feel free to open an issue and I can take a look.

No runtime deps