re: hash specifiers (John Hassey)
Wed, 12 Dec 90 14:33:07 gmt

          From comp.compilers

Related articles
re: hash specifiers (1990-12-12)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (John Hassey)
Keywords: design
Organization: Compilers Central
Date: Wed, 12 Dec 90 14:33:07 gmt

> From: (Adriaan Degroot)
> How does one build a hash function with minimal table size and minimal
> collisions for a known set of hash strings?

Take a look at gperf (part of the GNU libg++) here is the
readme file.

=== README from gperf ===
While teaching a data structures course at University of California,
Irvine, I developed a program called GPERF that generates perfect hash
functions for sets of key words. A perfect hash function is simply:

                    A hash function and a data structure that allows
                    recognition of a key word in a set of words using
                    exactly 1 probe into the data structure.

The gperf.texinfo file explains how the program works, the form of the
input, what options are available, and hints on choosing the best
options for particular key word sets. The texinfo file is readable
both via the GNU emacs `info' command, and is also suitable for
typesetting with TeX.

The enclosed Makefile creates the executable program ``gperf'' and
also runs some tests.

Output from the GPERF program is used to recognize reserved words in
the GNU C, GNU C++, and GNU Pascal compilers, as well as with the GNU
indent program.

Happy hacking!

Douglas C. Schmidt

=== end of readme ===

This is used by both Gnu C and C++. There is also a version in C somewhere.

John Hassey hassey@dg-rtp.DG.COM or ...!mcnc!rti!xyzzy!hassey
Data General Corp. Research Triangle Park NC, 27709

Post a followup to this message

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