News for hackers. Stuff that matters.
Re:Topiary: A code formatting engine leveraging Tree-sitter by IshKebab on Saturday May 20, 2023 @03:14PM (#36014710)
TreeSitter is easy to use, pretty language neutral and it is tolerant to errors. Plus at this point people have already implemented support for a ton of languages.

My only issue with it is that it really only does half the job. You get a CST of sorts, but if you want to do anything with it you pretty much have to hand write another parser for that node tree.

In contrast parser combinator libraries like Nom and Chumsky give you "the final output".

Re:Topiary: A code formatting engine leveraging Tree-sitter by hardwaregeek on Saturday May 20, 2023 @05:20PM (#36015735)
Chumsky is so good for parsing. I’m not a huge combinator fan but man, it works so well. If only the errors weren’t so horrendous.