1. 9
  1. 3

    For this reason, I recommend trying to write a recursive descent parser or two first, and only then moving on to a parser generator when the advantages of doing so will clearly outweigh the disadvantages.

    This is completely backwards, IMO. I think it’s better to start with a parser generator, then hand write if and when you need to. For Rust, I highly recommend lalrpop. This approach also has the advantage of raising errors for ambiguous grammars, which can help you design an easy-to-parse grammar.

    1. 1

      I prefer parser generators and they worked well for me, but I experienced some people don’t “get” it with parser generators but do get it with hand written parsers. Since my brain doesn’t work that way, I find these kinds of “learning style” issues deeply mysterious, but I came to admit that they certainly exist. Now I first recommend parser generators and grudgingly suggest hand written parsers when they struggle.

    2. 2

      I use nom

      1. 1

        I love a good handwritten parser tutorial but this one strikes me as making the process overly complex (mostly because of all the language features I think it uses unnecessarily). But I haven’t written one in Rust before. I’ll have to give it a shot.