> 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.
|