To the #Rust #rustlang community: I once started to write a #compiler / #parser with #nom #crate. However I had some struggles with it of how to provide **multiple** errors with line+column indicators for a parsed context.
Now I read a tiny bit about #syn and #chumsky 👀
Are they the right crates for me? Are there others?
I do not parse rust-code, but a completely custom language (similar to pugjs)

(Boost for reach 🙏)

damn chumsky error messages are straight up unreadable

#rust #chumsky #parsing

Quick question about #rust #chumsky : how do I get rid those ugly nested tuples in the final map? No way to discard them for real and receive a map(| (a, b)| ... ) ?

Sometimes, when programming in #Rust, I'm wondering whether there is a little Ferris in my computer whispering to all those 0's and 1's to behave correctly.  

Otherwise I can't describe the following experience:
1. Rewrite parts of #parsing a programming language from #nom to #chumsky (the parts that are most interleaved with each other => indirect recursion over multiple non-terminals!).
2. Run all affected tests
3. See all of them pass _on the first try!_

1/2

#RustLang #Magic

So what should this all tell you? It should tell you that:
- #Rust enables fearless prototyping, refactoring and maintenance of software
- you shouldn't be afraid of stepping into the unknown
- despite seeming very scary at first, #chumsky is more approachable than you might think - thank you to chumsky contributors for such an amazing crate!

10/11

#RustLang

Many people say that #Rust is very hard to #prototype with or to #refactor. This couldn't be further from the truth! It is the exact opposite!

Let me share with you one of the most profound experiences I had with #RustLang on a casual sunday - a thread đŸ§”

I'm currently rewriting my #transpiler from #nom to #chumsky and until now everything has turned out great so far, until I've hit the following road block:
Implementing parsers by using #parser functions that have indirect #recursion.

1/11

While I'm rewriting my #transpiler from #nom to #chumsky, I'm actually thinking about writing a nom-to-chumsky transpiler...

➰ 🙃

#Compiler

The #Rust #parser combinator experience:

1. Writing multiple parser combinator functions ✅
2. The most "higher up" parser fails ❌
3. Investigate reason 🔍
4. Find out it's a _whitespace_ char that has been parsed too eagerly 💡
5. Fix eagerly parsed whitespace 🔧
6. All tests pass ✅
7. Rinse and repeat ➰

In all seriousness: 95% of errors I have are due to me parsing whitespace too eagerly (this is good!).

I'm using #chumsky, btw (beautifully designed parser combinator crate!).

#RustLang

docs: hyperlink `then*` methods with each other by janriemer · Pull Request #606 · zesterer/chumsky

This hyperlinks then, then_ignore and ignore_then methods to each other and provides a short note when the other method(s) should be used. This improves discoverability of the methods and makes the...

GitHub

Sometimes, in order to stay flexible and fit, you need to do some (type) gymnastics đŸ€ž

Slowly getting the hang of #chumsky #parser combinator #crate đŸ€“

One concept (among others!) I haven't learned yet, but _will_ run into, is #recursion in chumsky. I know, there are good docs on it - it's just something I haven't gotten to yet.

All in all, I'm very happy with chumsky so far. Kudos to its maintainers! 🙂 đŸŽ©

#Rust #RustLang