Go to the first, previous, next, last section, table of contents.

Introduction

gperf is a perfect hash function generator written in C++. It transforms an n element user-specified keyword set W into a perfect hash function F. F uniquely maps keywords in W onto the range 0..k, where k >= n. If k = n then F is a minimal perfect hash function. gperf generates a 0..k element static lookup table and a pair of C functions. These functions determine whether a given character string s occurs in W, using at most one probe into the lookup table.

gperf currently generates the reserved keyword recognizer for lexical analyzers in several production and research compilers and language processing tools, including GNU C, GNU C++, GNU Pascal, GNU Modula 3, and GNU indent. Complete C++ source code for gperf is available via anonymous ftp from ics.uci.edu. gperf also is distributed along with the GNU libg++ library. A highly portable, functionally equivalent K&R C version of gperf is archived in comp.sources.unix, volume 20. Finally, a paper describing gperf's design and implementation in greater detail is available in the Second USENIX C++ Conference proceedings.


Go to the first, previous, next, last section, table of contents.