lilypond-user
[Top][All Lists]
Advanced

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

Re: Evolutionary User Strategy - A Compromise


From: Erik Sandberg
Subject: Re: Evolutionary User Strategy - A Compromise
Date: Wed, 12 Jul 2006 14:55:05 +0200
User-agent: KMail/1.9.1

On Wednesday 12 July 2006 12:59, Anthony Youngman wrote:
> Something I thought of (having seen the comment about convert-ly using
> grep ...)

It's not using grep, but it relies heavily on regexps (so it can somewhat 
fairly be compared to sed).

> I've got an on-off thing about writing a DATABASIC compiler (never mind)
> and have come across a tool called Antlr. It is a compiler-compiler and
> generates lexers, parsers and treeparsers.
>
> IF someone wants to put the effort in, it may (or may not be) easy to
> define various grammars to read in and chuck out different music
> formats. It sounds as though a lot of the problems (like the swap
> between < > and << >> for example) would be easy. Especially given
> lilypond's structure it looks like it would be fairly easy to define
> grammars which can read in or chuck out different lily version syntaxes,
> even the \addLyrics / \oldAddLyrics thing maybe.

I'd rather have a look at parsing expression grammars, see: 
http://en.wikipedia.org/wiki/Parsing_expression_grammar
Seems to combine simplicity of regexps with the power of CFGs. Doesn't seem to 
be widely implemented though.

Another way could be to go via the syntax expressions I'm working on: Instead 
of applying operations on .ly input, we could apply them to the parser's 
output, and then use some built-in version specific mechanism to convert 
finished files back to .ly. I thikn this would be both more reliable than 
convert-ly, and possibly easier to maintain, but some text formatting might 
be lost unless the syntax-expression->ly conversion is designed very 
carefully. Depending on how macros will be implemented, commands like 
\relative may be lost as well.

-- 
Erik





reply via email to

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