denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] lilypond import regression?


From: Richard Shann
Subject: Re: [Denemo-devel] lilypond import regression?
Date: Thu, 20 Oct 2011 09:25:10 +0100

On Wed, 2011-10-19 at 22:44 -0500, Jeremiah Benham wrote:
> On 10/19/2011 10:20 PM, Jeremiah Benham wrote:
> > The lilypond importer will import this properly:
> >
> > \relative c'' {
> >   a4 a a a
> > }
> >
> > The importer fails to import this:
> >
> > \relative c'' {
> >   a4 r a a
> > }
> >
> 
> The console prints this when importing the 2nd example:
> 
> ((x_MOVEMENT
>     (x_RELATIVE "c" . 2)
>     ((x_SEQUENTIAL
>        (x_CHORD
>          (x_NOTE ("a" . 0) "" "" "" (4 0) "")
>          .
>          "")
>        (x_CHORD (x_REST "r" "") . "")
>        (x_CHORD (x_NOTE ("a" . 0) "" "" "" "" "") . "")
>        (x_CHORD (x_NOTE ("a" . 0) "" "" "" "" "") . "")))))
> 
> ============= ====================== =============
> 
> 
> ** (denemo:6260): WARNING **:
> A script error for file/script (lyimport::load-file 
> "/home/jjbenham/Desktop/Denemo test/lilypond/" "test008.ly"); the throw 
> arguments are
> 
> (#f Wrong type (expecting ~A): ~S (pair ) ())
> 
> ** (denemo:6260): WARNING **:
> The tag is
> 
> wrong-type-arg
> 
> Parent: child exited, pid = 6275, exit status = 0
> 
> It appears to be a type mismatch.

Yes, the r is causing:
 a pair  whose first element is a list 
          starting with the token x_REST and having two strings "r" and
"" following, and whose second element is the string ""

while the notes 
 a pair whose first element is a list
            are starting the token x_NOTE, a pair comprising the string
"a" (or whatever the note is) and a number 0 followed by five more
elements the third of which is the duration (represented as a pair (4 0)
for duration 4). The five elements IIRC are the from the list pitch
exclamations questions octave_check optional_notemode_duration
optional_rest which occurs in this rule.

 (simple_element
        (pitch exclamations questions octave_check optional_notemode_duration
optional_rest) : (cons 'x_NOTE (list  $1 $2 $3 $4 $5 $6))
        (RESTNAME optional_notemode_duration) : (cons 'x_REST (list $1 $2))     
 )

This rule shows the origin of the difference between the two sorts of
simple element. A note can have things like exclamation mark to mean
show a reminder accidental, while a rest cannot. In fact the pitch can
be followed by \rest meaning one of those polyphonic rests that I have
just put support into Denemo for (they feature in the Pavana I
uploaded).

I am not sure whether it would be better to make things more uniform at
this level, or go for the higher up rule, which would seem to be
expecting the first form and not the second.
> > I started to look through the code. Maybe someone could help point me 
> > to the best way to debug this or tell me where the relevant procedure is.
As for a procedure to work with this: the most important thing to know
is that you can work in standalone mode (ie you do not have to invoke
Denemo to test, making development much quicker). You cd to the
directory with the test.ly in and invoke the parser/lexer (which are in
the same directory). The code sees that some special symbol ('Denemo I
think) is not defined and so immediately parses "test.ly" giving you the
denemo scheme as output.
So you just keep adding more constructs to test.ly and re-running the
parser/lexer.
There is a lot of joining the dots still to do in there, and one snazzy
bit, namely LilyPond accepts scheme input, for which we will need to
invoke the scheme (read ...) procedure to slurp up a whole scheme
expression (that is we don't write a whole scheme lexer inside our
lexer!).

Richard




> >
> > Thanks,
> > Jeremiah
> >
> > _______________________________________________
> > Denemo-devel mailing list
> > address@hidden
> > https://lists.gnu.org/mailman/listinfo/denemo-devel
> 
> 
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/denemo-devel





reply via email to

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