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)

Replies are listed 'Best First'.
Re^5: Surprised by Perl parse of ternary operator (bison)
by tye (Sage) 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