Gentoo Archives: gentoo-user

From: Kevin O'Gorman <kogorman@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Query: any good venue for sample lex&yacc or flex&bison programs
Date: Wed, 03 Sep 2008 02:57:04
Message-Id: 9acccfe50809021957l5f70fd10k54150f5dff7f19ac@mail.gmail.com
In Reply to: Re: [gentoo-user] Query: any good venue for sample lex&yacc or flex&bison programs by Etaoin Shrdlu
1 On Tue, Sep 2, 2008 at 6:28 AM, Etaoin Shrdlu <shrdlu@×××××××××××××.org> wrote:
2 > On Tuesday 2 September 2008, 07:01, Kevin O'Gorman wrote:
3 >
4 >> I've been teaching myself scanners over the summer, thinking to teach
5 >> my students this fall.
6 >>
7 >> It was hard because just about all of the examples are inadequate for
8 >> one of these reasons:
9 >> 1 They are pure lex, or pure yacc, not a combination. Ditto flex
10 >> and bison. Most of such sample programs work okay, but they're not
11 >> what's needed. Getting the parser and scanner to work together is the
12 >> key thing.
13 >> 2 They are spotty in their coverage of features
14 >> 3 They are incomplete and fail to compile as presented; the
15 >> documentation is very old-style UNIX in general, and very hard to
16 >> learn the necessary fixes from it.
17 >> 4 They are old and fail on modern versions of the software
18 >> 5 They are just plain broken
19 >>
20 >> This applies to examples in the texinfo pages, the 2003 O'Reilly book,
21 >> and online manuals.
22 >>
23 >> This is a very serious problem for learning these tools in their
24 >> combined form. I'm relatively good at dealing with such stuff (having
25 >> decades of practice), but I would not expect my undergrads to be able
26 >> to learn with these materials.
27 >>
28 >> I was finally able to cobble together a working flex/bison parser from
29 >> the bison-bridge example in an appendix to the flex info page. I'd
30 >> like to share it, and perhaps other _working_ sample programs to the
31 >> web at large. Does anyone know of a better venue for this than just
32 >> some random page on my school's web server? I would like other people
33 >> to be able to find this stuff and perhaps add to it or otherwise
34 >> improve on it.
35 >
36 > When I had to study the subject, I found these documents (in addition to
37 > the dragon book, which was of course the primary source of information
38 > for the underlying theory):
39 >
40 > http://epaperpress.com/lexandyacc/
41 > http://www.kiv.zcu.cz/~lobaz/fjp/yacc/compiler_flex_bison.pdf
42 > http://www.ibm.com/developerworks/linux/library/l-lexyac.html
43 >
44 > The above documents all contain examples of using lex+yacc together to
45 > build an interpreter for simple languages, which is enough for an
46 > undergrad course imho. Also, I seem to remember that the flex and bison
47 > online manuals and the examples therein were quite accurate (but I might
48 > be wrong, it was some time ago).
49 >
50 > I think a good place to discuss lex/yacc issues and get pointers to
51 > resources is the comp.compilers newsgroup, see
52 > http://compilers.iecc.com/index.phtml for more information, especially
53 > the FAQ section.
54 >
55 > Another good place (maybe even better, since it's targeted to beginners)
56 > is the compilers 101 mailing list, see
57 > http://tech.groups.yahoo.com/group/compilers101/ for more information.
58 >
59 >
60
61 Thanks, I've created a Google Group, and added these links to a page in it.
62 Check out http://groups.google.com/group/compilerSamples
63
64 --
65 Kevin O'Gorman, PhD

Replies

Subject Author
Re: [gentoo-user] Query: any good venue for sample lex&yacc or flex&bison programs Etaoin Shrdlu <shrdlu@×××××××××××××.org>