[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lilypond BNF

From: Han-Wen Nienhuys
Subject: Re: Lilypond BNF
Date: Tue, 26 Jul 2005 21:54:00 +0200
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)

Carl Sorensen wrote:
Almost a year ago, Pedro Kroger was working on a bnf description of
lilypond. (see
devel/2004-10/msg00074.html).  Han-Wen suggested hacking Bison so that
it would produce the BNF directly from the .yy file.

I went a different direction, and produced a python script that ignores
all the C++ stuff in parser.yy, resulting in a BNF description of
lilypond that is generated directly from the parser.

I've attached the script (, along with the result of running
the script on the current CVS version of parser.yy (lilypond.bnf).

I'd like to suggest that lilypond.bnf be added to the documentation, to
be automatically generated as part of the make process, using

That would be cool, but just dumping a BNF somewhere is a bit half-baked. Wouldn't it be better to make a "literate Yacc", where we intersperse explanations of the grammar (in texinfo format, so it can be integrated with the program reference manual) with the BNF itself? Also, a couple of nitpicks

 * BNF usually uses a slightly different syntax

  <nonterminal> ::=  <nt1> <nt2>

I believe. But frankly, I don't care about

 * The current script doesn't strip /* */ comments.

 Han-Wen Nienhuys - address@hidden -

reply via email to

[Prev in Thread] Current Thread [Next in Thread]