lilypond-devel
[Top][All Lists]
Advanced

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

Re: Premature evaluation.


From: David Kastrup
Subject: Re: Premature evaluation.
Date: Wed, 05 May 2010 17:44:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Carl Sorensen <address@hidden> writes:

> On 4/15/10 3:00 AM, "David Kastrup" <address@hidden> wrote:
>
>> 
>> Something like that.  Splitting scanning and evaluating into two
>> should ensure that the evaluation happens not at a time when the
>> parsing of preceding constructs has not yet properly completed.
>
> I'm sure that a patch would be gratefully accepted.  This is clearly
> undesirable behavior.

Here is the problem:

#(ly:export ...

needs to be evaluated _before_ a token gets produced.  There are a few
ways around that that are not particularly attractive:

a) just take a look at the unevaluated Scheme expression, and if it
starts with a car of ly:export, evaluate it right away.

That introduces the same timing hole we already had.

b) fiddle around with some rules like (quite oversimplified)

embedded_scm:
        SCM_TOKEN {
                  $$ = primitive_eval($1);
                  if (unpack_identifier($$)) {
                     push_token(unpack_identifier($$));
                     push_token(EXPECT_IDENTIFIER);
                  }
        }
        | SCM_IDENTIFIER
        ;

notreally_embedded_scm_after_all:
        embedded_scm EXPECT_IDENTIFIER { }
        ;

and then place notreally_embedded_scm_after_all before all occurences of
xxx_IDENTIFIER in the grammar.

Maybe I am missing some better option here.

-- 
David Kastrup





reply via email to

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