4 ms·
I'd highly recommend looking at a few toy parser projects, like this and Crafting Interpreters (which are both recursive decent, with very different styles), wr
by jtolmar 6y ago
I'd highly recommend looking at a few toy parser projects, like this and Crafting Interpreters (which are both recursive decent, with very different styles), writing however much of a typical parser you think makes sense "for fun," and then saving that somewhere you can get at it.
Writing a parser from scratch is kind of an obnoxious hurdle, but if you have some code you're already familiar with that you can copy-paste in and modify to your purposes, that's a lot more accessible.
(Also hats off to this author for making a parser so damn terse.)
- swyx 6y agowhat is "recursive decent"?
- newlikeice 6y agoman can dig hole. while digging one hole he finds two holes. he Diggs the one hole till he finds the bottom. climbs up to where he found the two the proceeds down the other hole. till he finds two more holes and then digs to the bottom of the first hole he finds until he hits bottom there. he descends until he hits bottom or digs through the earth. one hole at a time. the digging is just the way your language constructs itself into different elements spread out like directories and sub-directories.
- swyx 6y agoah. i was thrown off by the typo. i thought you were complimenting their decency.