Re: First and Follow sets

Ben Pfaff <>
24 May 2000 01:49:50 -0400

          From comp.compilers

Related articles
First and Follow sets (Jan Schulze) (2000-05-20)
Re: First and Follow sets (Robert Sherry) (2000-05-21)
Re: First and Follow sets (Paul Johnston) (2000-05-21)
Re: First and Follow sets (Hybrid) (2000-05-21)
Re: First and Follow sets (Tom Moog) (2000-05-22)
Re: First and Follow sets (Ben Pfaff) (2000-05-24)
Re: First and Follow sets (Pat Terry) (2000-05-28)
| List of all articles for this month |

From: Ben Pfaff <>
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
(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.