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

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

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
May 29, 2008 01:43
Subject:
Re: [perl #54974] Strange map {} Behavior When Returning Two Values
Message ID:
b77c1dce0805290142g5f4e16b2ge844c9dd0d745ef9@mail.gmail.com
2008/5/28 A. Pagaltzis via RT <perlbug-followup@perl.org>:
> 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
impossible.

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

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