develooper Front page | perl.perl5.porters | Postings from May 2008

Re: [perl #54974] Strange map {} Behavior When Returning Two Values

Thread Previous | Thread Next
Rafael Garcia-Suarez
May 29, 2008 01:43
Re: [perl #54974] Strange map {} Behavior When Returning Two Values
Message ID:
2008/5/28 A. Pagaltzis via RT <>:
> Really this should be decided based on whether the closing brace
> is followed by a comma or not, so in some sense this is certainly
> a bug. But my understanding is that the syntactic ambiguity of
> curly braces in Perl is difficult to handle in perl's ultimately
> yacc-derived (but heavily mutated) parser, which uses a limited
> lookahead for curlies to work around the fact that this style of
> parser strongly favours tokens with only a single meaning. In
> practice, the heuristic works most of the time and the
> disambiguation cues are easy to employ.

Perl's parser is strictly a LALR(1) yacc-generated parser -- not a
"havily mutated" thingy. That means that it uses only one token of
lookahead, and that detecting anything after a closing brace is

The smoke and mirrors are strictly kept in the tokenizer, which is
stateful, contrary to most classical tokenizers (like the ones lex

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About