Open utterances-bot opened 2 years ago
I'm trying to out comments for the blog -- let me know if there's any problems.
Very nice introduction to Nom! Thank you for posting :-)
I had a problem on grasping the concept of how even to use nom, but going through this blog, I've more in-depth knowledge on how and the core concepts of the crate. Thanks for effort on putting this out here man.
Any reason to use Nom over the other? Such Pest. I have built an app using Pest, but don't have any experience with Nom.
I've been rewriting a pretty big production parser for KittyCAD into Winnow. I'll definitely be writing about Winnow soon. I think it offers some nice improvements over Nom and has a lot of potential. I found one big bug, but the maintainer fixed it within a few hours of me posting a reproduction, and released a new version. So, I'm very happy.
I haven't used grammar generators like pest before! I gave it a try once for a small project, couldn't figure it out within 20 minutes and went back to Nom. I'd like to try it again though.
On Thu, 5 Oct 2023, 10:33 pm Azzam S.A, @.***> wrote:
Any reason to use Nom over the other? Such Pest. I have built an app https://github.com/azzamsa/nai using Pest, but don't have any experience with Nom.
- https://github.com/rosetta-rs/parse-rosetta-rs
- nicoburns/blessed-rs#85 (comment) https://github.com/nicoburns/blessed-rs/issues/85#issuecomment-1635092972
— Reply to this email directly, view it on GitHub https://github.com/adamchalmers/blog/issues/3#issuecomment-1749937434, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJIFYM2G2VO7ZGJVHB4DJLX553Y5AVCNFSM5LRYBFE2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZUHE4TGNZUGM2A . You are receiving this because you commented.Message ID: @.***>
I'll definitely be writing about Winnow soon.
Can't wait to read it.
Hi Adam, I've been attempting to dive in and understand the Nom crate for about two weeks now. I thought I'd start with something simple, like parsing a sentence to look for a certain word. No matter what I try, I can't figure out how to put it all together. I understand the fundamentals (I think) about individual parsers and what they return, but I feel there is something fundamental I'm missing. The docs are lacking and, other than your blog, there just isn't much out there.
How do you iterate with Nom?
Hi! You don't really iterate, there's no loops or iterators. Instead you use combinators like many1(p) which runs the p parser one or more times.
To parse a sentence I'd:
separated_list1(char(' '), word)
which parses a sequence of words separated by spaces. p
terminated(p, char('.'))
to parse a sequence of words separated by spaces, ending with a full stop. Thanks! That helped a lot. After reading your suggestions I worked out how to parse multiple sentences with periods. Now I just have to work in other types of punctuation!
Parsing Text with Nom
Blogging, generally about Rust
https://blog.adamchalmers.com/nom-chars/