lilypond-devel
[Top][All Lists]
Advanced

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

Re: Anybody else with an interest in parser wrangling?


From: David Kastrup
Subject: Re: Anybody else with an interest in parser wrangling?
Date: Mon, 20 Mar 2023 15:46:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Jean Abou Samra <jean@abou-samra.fr> writes:

> Le lundi 20 mars 2023 à 00:15 +0100, David Kastrup a écrit :
>
>> The MYBACKUP and MYPARSE stuff messes with the input in order to trigger  
>> syntactic decisions based on expression values.  That's a bit more than  
>> usually expected from a Bison-generated parser.
>
>
> Yes, I understand the basic way Bison parsers work. What I don't
> understand is what other “effects” the lookahead can have, and why
> having caused the reduction of the current rule is never a
> problem. AFAIU, the parser works as a loop
>
> - Get next token from lexer.
>
> - Decide whether to shift or to reduce some rule. Use a lookahead
> token if necessary.
>
> - Do the shift or the reduction and execute the semantic action.
>
> The lookahead token gets switched during the semantic action. Isn't it
> a problem if the previous lookahead token says the current rule should
> be reduced, but the new one would have required shifting? Or is that
> just not a useful use of MYBACKUP/MYREPARSE?

Well, if you feel you should not touch that code until you confidently
know the answer to that question, let me assure you that the principal
justification for that code is that I needed it to work.

The equivalent in football is called a "Hail Mary pass" I believe.

-- 
David Kastrup



reply via email to

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