You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the discussion in mozilla/mentat#139, I expect we'll be parsing EDN and then layering on additional parsers (query parser, transaction parser, perhaps others). It would be nice if we could use the same parser generation toolkit for parsing strings and EDN token streams.
From http://dragostis.github.io/pest/pest/trait.Input.html, I see that pest's intention is to parse strings (or byte streams). (e.g., http://dragostis.github.io/pest/pest/trait.Input.html#tymethod.slice accepts a general Input but requires it to effectively be a string.)
A parser in nom is a function which, for an input type I, an output type O, and an optional error type E, will have the following signature: fn parser(input: I) -> IResult<I, O, E>;
The text was updated successfully, but these errors were encountered:
So, it appears that nom doesn't do a great job with this: see rust-bakery/nom#266, which is harder than our problem, but similar. I think nom could be bent to our purposes, but it's clear that bytes are the first-class thing and arbitrary tokens second-class.
A few more notes after playing with combine a bit: generally, folks migrate from nom to combine to get better error reporting. I can't speak to the differences yet.
There are some kinks when defining higher order parsers using combine; the obvious const p: ... = many(...) doesn't work. I think this is actually rooted in Rust's need to know the type and size of p statically, which doesn't play that nicely with combine in some cases. This may just be my Rust ignorance, though!
Following the discussion in mozilla/mentat#139, I expect we'll be parsing EDN and then layering on additional parsers (query parser, transaction parser, perhaps others). It would be nice if we could use the same parser generation toolkit for parsing strings and EDN token streams.
From http://dragostis.github.io/pest/pest/trait.Input.html, I see that pest's intention is to parse strings (or byte streams). (e.g.,
http://dragostis.github.io/pest/pest/trait.Input.html#tymethod.slice
accepts a generalInput
but requires it to effectively be a string.)I see that nom is more general. (Doubtless there are other, more general, PEG generators as well.) From https://github.com/Geal/nom#parser-combinators:
The text was updated successfully, but these errors were encountered: