3 ms·
I've been struggling to find presentations of parsers and parsing that really peels back the magic and shows how everything works, without just punting and lett
by btilly 14y ago
I've been struggling to find presentations of parsers and parsing that really peels back the magic and shows how everything works, without just punting and letting Lex and Yacc do the dirty work (btw if you know of a compiler text that doesn't do this, let me know!)
Here you go: http://www.cs.rochester.edu/~scott/pragmatics/ http://www.cs.rochester.edu/~scott/pragmatics/
(Expect to spend several months reading it.)
- aaronblohowiak 14y agohttp://www.bayfronttechnologies.com/mc_tutorial.html http://www.bayfronttechnologies.com/mc_tutorial.html
- btilly 14y agoThat explains how to write a top-down (or recursive-descent) parser. Humans generally find it easier to understand and write top-down parsers. Tools like YACC exist to make it easier for humans to specify bottom-up (or shift-reduce) parsers. They have a number of benefits over top-down parsers including performance. If you want to understand the magic of YACC, without the whole "it's magic" bit, you need to understand how to write shift-reduce parsers.
- seanmcdirmid 14y agoRecursive descent is nice if you want to finesse your error recovery, which is much more important these days than raw parsing performance. Times are a changing...
- aaronblohowiak 14y agoAhh, I have not really dug into shift-reduce parsers, but I am finding the wikipedia article to be surprisingly well written (once you get to the portion about the gramar for the example..)
- spacemanaki 14y agoI have Scott's book, and I've read his coverage of parsing, although it's been over a year since, and TBH I don't think it's very good. The whole book just tries to cover too much, and ends up doing a fair amount of hand waving.
- btilly 14y agoIt covers a lot, but I didn't see much handwaving about the basics of parsing. Particularly the sections that apply to the functionality that people would use lex and yacc for.