Re: First and Follow sets

Ben Pfaff <pfaffben@msu.edu>
24 May 2000 01:49:50 -0400

          From comp.compilers

Related articles
First and Follow sets csuhu@csv.warwick.ac.uk (Jan Schulze) (2000-05-20)
Re: First and Follow sets rsherry@home.com (Robert Sherry) (2000-05-21)
Re: First and Follow sets johnston.p@worldnet.att.net (Paul Johnston) (2000-05-21)
Re: First and Follow sets hybrid@dol.ru (Hybrid) (2000-05-21)
Re: First and Follow sets tmoog@polhode.com (Tom Moog) (2000-05-22)
Re: First and Follow sets pfaffben@msu.edu (Ben Pfaff) (2000-05-24)
Re: First and Follow sets p.terry@ru.ac.za (Pat Terry) (2000-05-28)
| List of all articles for this month |

From: Ben Pfaff <pfaffben@msu.edu>
Newsgroups: comp.compilers
Date: 24 May 2000 01:49:50 -0400
Organization: Michigan State University
References: 00-05-074 00-05-079 00-05-087
Keywords: parse

[OP's question was concerning how FIRST and FOLLOW sets work.]


I've recently written a simple parser-generator for SLR grammars
based very literally on the Dragon Book's algorithms, with very
little attempt to optimize. It's meant for use with exactly one
grammar--the one that the little literate programming tool I'm
writing uses--but it does work fine with all the SLR grammars
I've tried.


One of its few features, which I used during debugging, is that
it can print FIRST and FOLLOW sets as it runs. Hopefully you
will find this useful and interesting.


It's written in carefully commented, strictly compliant ANSI C89.
You're welcome to download it from
http://www.msu.edu/user/pfaffben/slr.c
(Since it's eventually going to go into a GNU software program,
it's GPL'd and copyright FSF.)


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.