repository files

... history


2020 June 21


This is an experimental BibTeX parser and processor; it's the beginnings of a BibTeX replacement in Racket. The parser is robust and should be re-usable; the BibTeX processor is still sketchy.

The parser should be able to parse all valid (and non-pathological) BibTeX. The library includes a rather thorough set of BibTeX unit tests, which might be of use to someone working on a similar project in this or another language.

So much for the parser...; the processor is more preliminary. It can apply some btxhak-style transformations, including parsing and reformatting author names. However I rather lost steam with it, as I lost faith that there was a real need for this (the project started off being a BibTeX parser, and the transformation bit is rather an overshoot).

This is not, therefore, in a nice releasable state – there's little documentation, and the 'bibulous' script is really only an illustration of how a BibTeX-replacement might work. If you're interested in this sort of thing, do get in touch – it might not take a lot to get me re-interested in this project.


The grammar in bibtex-parser.rkt is home-made. I've subsequently discovered that Beebe has published a BibTeX grammar, in bibparse, which refers to Nelson H. F. Beebe, Bibliography prettyprinting and syntax checking, TUGboat (ISSN 0896-3207) 14(3) 222, October 1993, and TUGboat 14(4) 395--419, December 1993. I don't believe there are significant differences between the grammars.

This package includes a parser for author names, based on the BibTeX specification for author names. This specification, unfortunately, is rather thin in places; the parser in bibtex-parser.rkt therefore resolves these ambiguities in what seems the most sensible way, but others might well disagree.

Sometimes, the problems spring from the fact that names are just hard, and don't always fit neatly into the first-name/surname paradigm that's built in to BibTeX. Perhaps life is hard. See the Dublin Core notes on name representation and James Clark's notes on Thai personal names for entertaining complications.

There's also a thing called mlbibtex, which is intended to be a multilingual BibTeX, but which interestingly appears to be implemented in Scheme. However there doesn't appear to be a distribution of it, only occasional EuroTeX presentations.

Having said that...


Build the parser and friends with (cd src; ./configure; make; make check).

After that, set PLTCOLLECTS=.../src/build: and require the library with

(require (lib "bibulous/bibtex-parser")
         (lib "bibulous/btxhak"))

The 'bibulous' script is an example of how one might use the library – it's basically a very simple bibtex-like command, which parses an input .aux file, extracts the cited elements from the associated .bib file, and formats them.

% .../bibulous <foo.aux

See the test scripts in src/test, and the bibulous script, for examples of use (the only documentation available, right now).

Norman Gray

2020 June 21