After wasting company time reading the source code to your ugly little source code filter (not one line of which is documented, commented, or otherwise annotated, by the way!), I found out that I was right all along: it's just a source filter. You can get exactly the same results with an external program, and the results will be more explicit and obvious. Your code doesn't give any insights into how to parse perl at all. It's a red herring, or worse, a wild goose chase.
The hard part is figuring out things like how to pull apart a perl statement with an embedded "do" subexpression.
And now that I consider symbol table tricks, and evals, and s///e, and the stupid @INC trick that makes your source filter work, and all sorts of run-time ugliness, I certainly don't know how to make such a convoluted system behave itself. I'm pretty sure it involves knowning a great deal more than I do about how perl's grammar is laid out; which is work that I frankly don't think an application level developer should have to waste his time on. These are problems that are trivial for the language maintainers with that vast perl grammar memorized, but they're all but impossible for anyone who doesn't.
To solve my immediate problem, I just commented out all the use statements, and a good chunk of the existing code; the syntax check now passes. I have no solution to the larger problem of how to do a correct syntax check for perl. I have no good way to fix the problem; and now you're telling me the perl designers don't care in the slightest. :-(
I don't know any Perl designer who agrees with you, so I say with some confidence that that's never going to happen.
Time to find a language with designers who care about the user's time and productivity, then. :-( I thought that was perl. I guess I thought wrong. :-( I hear Python at least has a BNF grammar... :-(
In reply to Re^10: Syntax checking without BEGIN blocks
by Anonymous Monk
in thread Syntax checking without BEGIN blocks
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |