develooper Front page | perl.perl5.porters | Postings from July 2009

Re: Rvalue given() blocks

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
July 21, 2009 00:58
Subject:
Re: Rvalue given() blocks
Message ID:
b77c1dce0907210058n12d07dc4m2d314b11a6b732ca@mail.gmail.com
2009/7/20 Rafael Garcia-Suarez <rgarciasuarez@gmail.com>:
> 2009/7/20 Vincent Pit <perl@profvince.com>:
>>
>>> This is extremely neat.
>>> However by looking at the perly.y part of the patch (I haven't looked
>>> at the other ones yet) I see that you add switch as a derivation for
>>> the term rule, but switch can begin with a label. And terms don't.
>>>
>>> I'd rather have a new rule
>>> switch : label given;
>>> and add given to term.
>>>
>>
>> The problem in this approach is that it makes bison complain about some
>> reduce/reduce conflicts. I'm unsure if those are genuine or not.
>
> I think they are.
> Without looking at the code: I think bison doesn't know whether he
> should reduce as a given-expression, or as a given-statement. And
> without infinite lookahead that's not going to work.
> If we remove given-statement, that will mandate a semicolon at the end
> of a given block, as for any expression. That's not nice either.
> Basically that construct is too ambiguous now...

Another idea. Split "given" into two tokens, and make the tokenizer
return one or the other depending on the value of PL_expect. Probably
XSTATE versus XTERM. Details will have to be worked out. Not sure if
it will work.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About