in reply to Re^2: Writing Interpreters, Compilers and Translators in Perl
in thread Writing Interpreters, Compilers and Translators in Perl
Good luck, this is one of my favourite topics ;)
There is a recent new animal called Parse::Eyapp which deserves having a look. Also Manning has released recently a book on the subject of parsing with Perl.
Would be nice to have a review of table-driven top-down parsing and possible speed advantage of (almost)infinite backtracking: look at packrat parsing in Wikipedia and google for SLK, and then you could tell us how to do a fast version of Parse::RecDescent, and if you start the project maybe i'll even help you ;).
PPI has some interesting comments in its doc about parsing in general. It would be really nice to have a survey of the various techniques used in the various sucessful parsers written in Perl (even the ones with C parts) so that it could be extrapolated a useful set of rules for a generic useful (fast, easy to use) parser generator .
Another interesting line of thought is "chunk parsing" and give the illusion of "stream" regexes. Obviously what is needed is a smart tokenizer. One simple approach is to have various chunk levels, you drive a simple m//gc regex-based lexer with a small chunk (string); if match you add chunk to have always minimum length and if no-match you add it another chunk and some kind of heuristics which enable switching to something faster if parsing comment-like or quotish-like (pretokenizing on big chunks)...some ideas can be taken from IO::Tokenizer, IO::Mark and the such
Cheers --stephan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Writing Interpreters, Compilers and Translators in Perl
by casiano (Pilgrim) on Jul 14, 2007 at 11:08 UTC | |
|
Re^4: Writing Interpreters, Compilers and Translators in Perl
by Moron (Curate) on May 30, 2007 at 14:47 UTC | |
by sgt (Deacon) on May 30, 2007 at 16:15 UTC |