Gentoo Archives: gentoo-user

From: Kevin O'Gorman <kogorman@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Query: any good venue for sample lex&yacc or flex&bison programs
Date: Tue, 02 Sep 2008 05:01:17
1 I've been teaching myself scanners over the summer, thinking to teach
2 my students this fall.
4 It was hard because just about all of the examples are inadequate for
5 one of these reasons:
6 1 They are pure lex, or pure yacc, not a combination. Ditto flex
7 and bison. Most of such sample programs work okay, but they're not
8 what's needed. Getting the parser and scanner to work together is the
9 key thing.
10 2 They are spotty in their coverage of features
11 3 They are incomplete and fail to compile as presented; the
12 documentation is very old-style UNIX in general, and very hard to
13 learn the necessary fixes from it.
14 4 They are old and fail on modern versions of the software
15 5 They are just plain broken
17 This applies to examples in the texinfo pages, the 2003 O'Reilly book,
18 and online manuals.
20 This is a very serious problem for learning these tools in their
21 combined form. I'm relatively good at dealing with such stuff (having
22 decades of practice), but I would not expect my undergrads to be able
23 to learn with these materials.
25 I was finally able to cobble together a working flex/bison parser from
26 the bison-bridge example in an appendix to the flex info page. I'd
27 like to share it, and perhaps other _working_ sample programs to the
28 web at large. Does anyone know of a better venue for this than just
29 some random page on my school's web server? I would like other people
30 to be able to find this stuff and perhaps add to it or otherwise
31 improve on it.
33 --
34 Kevin O'Gorman, PhD