I've been teaching myself scanners over the summer, thinking to teach my students this fall.
It was hard because just about all of the examples are inadequate for one of these reasons: 1 They are pure lex, or pure yacc, not a combination. Ditto flex and bison. Most of such sample programs work okay, but they're not what's needed. Getting the parser and scanner to work together is the key thing. 2 They are spotty in their coverage of features 3 They are incomplete and fail to compile as presented; the documentation is very old-style UNIX in general, and very hard to learn the necessary fixes from it. 4 They are old and fail on modern versions of the software 5 They are just plain broken This applies to examples in the texinfo pages, the 2003 O'Reilly book, and online manuals. This is a very serious problem for learning these tools in their combined form. I'm relatively good at dealing with such stuff (having decades of practice), but I would not expect my undergrads to be able to learn with these materials. I was finally able to cobble together a working flex/bison parser from the bison-bridge example in an appendix to the flex info page. I'd like to share it, and perhaps other _working_ sample programs to the web at large. Does anyone know of a better venue for this than just some random page on my school's web server? I would like other people to be able to find this stuff and perhaps add to it or otherwise improve on it. -- Kevin O'Gorman, PhD