User's Guide to gperf - 2. Introduction

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

# 2. 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` and `ftp.santafe.edu`. `gperf` was also distributed along with the GNU libg++ library for several years. 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.