Marpa will handle both left- and right-recursion in linear time. Marpa would accept directly all three of the grammars that you describe. The left- and right-recursive grammars would be parsed in linear time. The one which is both left and right-recursive is ambiguous, and so might be non-linear.

Marpa parses only context-free grammars, so its core algorithm does not handle context. But neither does PRD's core algorithm, which is LL and considerably less powerful than Marpa's. Both Marpa and PRD use "add-on" features to allow context sensitivity.

When it comes to extensions like context-sensitivity, PRD has the advantage of being based on recursive descent, which modern programmers find intuitive, and which has a very long track record. Marpa also has features which allow context-sensitivity. For the most general case, you can take the context-free subset of the grammar, produce an ambiguous parse, and then using ranking and/or selection. A more targeted approach could use Marpa's ability to track the progress of the parse token-by-token, and alter the input based on what it sees.

Marpa's underlying algorithm is highly mathematical and far from intuitive. But this comes with a compensating advantage -- Marpa can and has been converted to C, in which form it is over 20 times as fast. Recursive descent's advantages come from easy customization, making C conversion difficult or impractical.

So for context-sensitivity, it's a matter of different strategies. My own highly biased opinion is that many applications will find Marpa an advance over recursive descent.


In reply to Re^5: Writing a Programming Language in Perl by Jeffrey Kegler
in thread Writing a Programming Language in Perl by programmer99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.