btparse is a C library for parsing and processing BibTeX files. It provides a
lexical scanner and LR parser (constructed by PCCTS), both of which are
efficient and offer good error detection and recovery; a set of functions for
traversing the AST (abstract syntax tree) generated by the parser; and utility
functions for manipulating strings according to BibTeX conventions. (Note that
nothing in the library assumes that you're using BibTeX files for their
original purpose of bibliographic data for scholarly publications; you could
use the file format for any conceivable purpose that fits it. However, there is
some code in the library that is really only appropriate for use with strings
meant to be processed in the same way that BibTeX itself does. This is all
entirely optional, though.)
Note that the interface provided by btparse, while complete, is fairly
low-level. If you have more sophisticated needs, you might be interested my
Text::BibTeX module for Perl 5 (available on CPAN).