Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: Surprised by Perl parse of ternary operator (parsing)

by wrog (Monk)
on Jan 16, 2012 at 00:27 UTC ( #948036=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Surprised by Perl parse of ternary operator (parsing)
in thread Surprised by Perl parse of ternary operator

if I remember correctly, perl does not use LALR (yacc/bison) parsing but rather uses a Pratt-style precedence parser which is a kind of recursive descent but in which each operator is assigned a distinct left and right precedence...


Comment on Re^4: Surprised by Perl parse of ternary operator (parsing)
Re^5: Surprised by Perl parse of ternary operator (bison)
by tye (Cardinal) on Jan 16, 2012 at 04:32 UTC

    I quoted the relevant bits of perly.y and that file does indeed get processed by bison (see Makefile.SH and regen_perly.pl). "git grep -i pratt" finds 0 hits. Perhaps a "Pratt-style precedence parser" is used, but, if so, it seems quite weird that bison declarations of precedence are still included in the source code.

    So, to me, it looks pretty likely that Perl's parsing of ?: is mostly how bison-style declared precedence works.

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948036]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-08-28 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (259 votes), past polls