When I was playing around with it, I used PPI as a lexer -- that is, you don't have to let PPI go beyond the lexing stage, you can just ask it for tokens, and take over from there. PPI does a good job of lexing Perl, but there are some gotchas in the Perl lexing and these it passes on. For exmaple, there are the ghostly semi-colons <http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2010/06/parsing-with-ruby-slippers.html>, which I described in in my blog posts -- they were one of the first applications of the Ruby Slippers.

All in all, I found the Perl YACC/Bison grammar to be surprising non-tricky -- much less tricky than C's. But LALR is not nearly enough by itself to parse Perl, so extra pre- and post-processing is applied, and it is in that code that things get really wierd <http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2011/10/perl-and-parsing-12-beating-up-on-the-use-statement.html>.

-- jeffrey

On 01/09/2014 09:37 PM, Durand Jean-Damien wrote:
ok, got the answer from perldoc perl5int - I can give it a try in my spare time

Le jeudi 9 janvier 2014 20:34:47 UTC+1, Durand Jean-Damien a écrit :

    yacc/lex of perl5 is in its source tree ?
    HAving done C I know some of the pitfalls when starting from a
    yacc/lex form -;

    Le jeudi 9 janvier 2014 18:48:05 UTC+1, Jeffrey Kegler a écrit :

        Gee whiz, Reini, we were waiting for you. :-)

        More seriously, I have one suggestion for anyone thinking of
        writing a Marpa-powered Perl grammar. I made a start at it,
and it's in the test suite. Do *NOT* bother looking at it. It's based on an older, pre-events Marpa, and it is best not
        to waste time on it and to make a fresh start from the YACC
        grammar in the Perl source.

        -- jeffrey

        On 01/09/2014 09:34 AM, Reini Urban wrote:
        On Thu, Jan 9, 2014 at 10:08 AM, Jeffrey Kegler
        <[email protected]>  wrote:
        Reini would be our list's expert on this, but since we haven't heard 
from
        him, I'll throw in my guess -- it looks like they are using PPI to 
parse.
        The grammar you linked to apparently does not guide the parsing -- it's 
used
        to implement an interface. -- jeffrey
        Yes, right. PPI is used for rperl, and the guide is just for the API 
overview.

        Marpa would be faster, but we don't have a perl grammar for marpa yet.
        I'm counting on you, guys.
        Also for p2, where I had to write my incomplete perl grammar from 
scratch

        On 01/07/2014 11:09 AM, Durand Jean-Damien wrote:

        Was reading thisblogs.perl.org  <http://blogs.perl.org>  post about 
rperl and interestingly this
        grammar.
        Sound heaviily Marpa compatible - but is that really Marpa behind - 
somebody
        knows?

--
You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "marpa 
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to