> There are quite a few heuristics that the parser uses that aren't all too well documented,

I agree, it's messy. But that's a matter of research.

For instance I was bitten when operator overloading of < and > became unreliable, because the parser thought that < is the start of a <> iterator.

I also remember a time where this was legal syntax

for qw/a b c/ { }

and BTW this is a list multiplication, even without parens around

qw/a b c/ x 3

> At some point I was considering researching and making a list of all of the reasons, but I unfortunately never got around to it.

I think this could be solved by an automatic approach training an external parser against automatically created code and snippets harvested from CPAN.

The test would pass if (a patched) B::Deparse created the same syntax tree after compilation.

Many people already invested time in parsers ( I could name at least half a dozen projects), those tests could be used too.

As a side product, P5P would get a proper test suite too.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re^4: On Parsing Perl (Once upon a time) by LanX
in thread On Parsing Perl by merlyn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.