News for hackers. Stuff that matters.
Re:The hardest program I've ever written (2015) by duped on Saturday March 05, 2022 @11:41AM (#30568996)
The AST usually isn't enough, you want a CST (or what a few sources call "full" syntax tree, preserving white space, comments, etc). I think .NET has the best implementation of this out there, unsurprisingly they have incredible tooling support.
Re:The hardest program I've ever written (2015) by eyelidlessness on Saturday March 05, 2022 @04:19PM (#30572004)
For anyone interested in CST tooling outside of the .NET ecosystem, tree-sitter[1] is general purpose, quite fast, supports a wide range of grammars, and has bindings in quite a lot of environments (including WASM, so likely can be used anywhere with some effort).

1: https://tree-sitter.github.io/tree-sitter/

Re:The hardest program I've ever written (2015) by duped on Saturday March 05, 2022 @05:17PM (#30572504)
Tree sitter is absurdly complicated to use in a real project, a hand written parser might be slower but it's way easier to implement and build.
Re:The hardest program I've ever written (2015) by eyelidlessness on Saturday March 05, 2022 @07:44PM (#30573705)
I haven’t used it in a real project yet, but I’ve tried it out for a few project ideas, and haven’t found it complicated to use. I’m not necessarily saying it isn’t ever complicated, but I was able to knock out a couple proofs of concept in a few hours. My only complaint so far is that the sexpr representation lacks some details, but I have no problem with working around that.