Re: A BibTeX grammar

Might this not be a case where parsing into XML might give some useful insight… if so how might the ‘sensitivity’ be indicated?

Sent from my iPad

> On 17 Feb 2022, at 18:19, C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com> wrote:
> 
> 
> Norm Tovey-Walsh writes:
> 
>>>> Am I missing something?
>>> 
>>> What am *I* missing?
>> 
>> A comma.
>> 
>>  entry: -"@", @type, s*, -'{', s*, @citekey, fields?, s* -'}' .
>> ...
>>  entry: -"@", @type, s*, -'{', s*, @citekey, fields?, s*, -'}' .
>> ...
> 
>> That’s ugly. I wonder if there’s anything reasonable that we could do
>> to make that less likely.
> 
> Yeow.  That was hard to see.
> 
> Syntactically, I don't know if there is any nice solution to make that
> error more detectable.
> 
> Given the current syntax, I can think of two things that might have
> surfaced the error:
> 
> (1) extra parentheses around the body of the entry (or reification as a
> nonterminal):
> 
>  entry: -"@", @type, s*, -'{', (s*, @citekey, fields?, s*) -'}' .
> 
>  entry: -"@", @type, s*, -'{', entry-body -'}' .
>  -entrybody: s*, @citekey, fields?, s*.
> 
> but I know no motivation for inserting those parentheses, or for that
> matter using that extra nonterminal.
> 
> (2) a linter of some kind.  It might be as simple as a translation of
> the grammar into prose, the way some XML documentation does it:
> 
>    An entry is a sequence of
>    - the character "@"
>    - a type (q.v.)
>    - zero or more occurrences of s (q.v.)
>    - the character "{"
>    - zero or more occurrences of s (q.v.)
>    - a citekey (q.v.)
>    - an optional occurrence of fields (q.v.)
>    - zero or more occurrences of s (q.v.) separated 
>      by the character "}"
> 
> Here I've used (q.v.) to mark what would be hyperlinks to the
> description of that nonterminal.
> 
> I should put that on the list of tools to add to Gingersnap.
> 
> -- 
> C. M. Sperberg-McQueen
> Black Mesa Technologies LLC
> http://blackmesatech.com
> 

Received on Thursday, 17 February 2022 18:49:18 UTC