I was recently tasked with extracting information and consolidating a large number of BibTeX files. Should be easy enough, there are perl and python modules to parse it... Well, that's what I thought. Turns out that the files I was given have all kinds of oddities. And all of the parsers I threw at it, would error out at some point or other. The files are known to be "correct" as in so far that bibtex and LaTeX don't show any errors and produce the expected output. So, it must be clearly the third-party parsers. I tried to figure out what the bibtex file syntax is supposed to be, but could only find partial and informal definitions here and there. I tried to read the bibtex source code, which, considering its age, the language it is written in (web) and being two hand written parsers, is not an easy task.
Before I start wasting time, I wanted to ask whether there is somewhere a formal definition of the bibtex file? Or, if not, whether there is an easier place where I can extract it from, than the 36 year old artefact that is called bibtex.web.
Edit: I looked already through the tex docs that is concerned about bibtex and also read the LaTeX Companion's chapter on bibtex. I googled for all terms I could think of, but none gave me any result.