in reply to Re^3: Writing Interpreters, Compilers and Translators in Perl
in thread Writing Interpreters, Compilers and Translators in Perl

Thanks for your suggestions. I'll definitely be taking some of them on board. In regard to your comment about smart tokenising, I have a sort of negatively-matching lexer for that I call the antilexer which I might include but only if it survives as a sensible alternative after CPAN modules have been thorughly investigated.

For large continuous streams and such-like where I can't use the usual module, I use instance variables that have rules, recursion depths at which to start building trees, callback functions definable as "parser exits" (that's something I picked up from old prePerl technoliogy) to be invoked at certain points so that the tree never needs to be completed but can be acted on or code generated on the fly and I am sure there are other special needs situations I haven;t yet thought of!

It's a horrible minefield but I love it too ;);) after all - if the subject were reducible to bolting modules together and that working for every case, it wouldn't be so interesting, would it?

__________________________________________________________________________________

^M Free your mind!

  • Comment on Re^4: Writing Interpreters, Compilers and Translators in Perl

Replies are listed 'Best First'.
Re^5: Writing Interpreters, Compilers and Translators in Perl
by sgt (Deacon) on May 30, 2007 at 16:15 UTC
    ...More thoughts...

    There is a new edition of the book by Grune et al Parsing Techniques. It should be out or close.

    Often people think about LR or LL parsing but the first edition of "Parsing Techniques" talks about starting anywhere! which is interesting at least in the sense of having maybe two-staged tokenizing <chess>?!</chess>

    then there is HOP::Lexer. I haven't played much but it is quite slower than anything based on Parse::Yapp. Still a mixed approach could be nice...

    finally using 5.9.x or more one can plug a different regexp engine, say a small one that permits "streaming"

    Update: [SDF] seems also interesting.

    cheers --stephan