Marpa allows ambiguous lexemes; in external lexing you can read those
several alternative lexemes via several calls to lexeme_alternative() [1]
and then a single call to lexeme_complete() [2] and, provided the grammar
has the appropriate rules, this will lead to a parse forest (use example of
a parse forest with internal lexing can be found in [3]).

Marpa will use both pairs to continue both parses if you give it a grammar
which defines rules for such both pairs, example is also in [3]. And, if
you have enough rules, Marpa will parse the input according to them and
will allow you to handle the multiple parse results.

There is also an article on external lexing [4] by Michael Roberts.

Hope this helps.

[1]
https://metacpan.org/pod/distribution/Marpa-R2/pod/Scanless/R.pod#lexeme_alternative

[2]
https://metacpan.org/pod/distribution/Marpa-R2/pod/Scanless/R.pod#lexeme_complete

[3] https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/t/sl_panda.t
https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/t/sl_panda1.t

[4] http://www.vivtek.com/marpa/external_tokenizer.html

On Sun, Feb 15, 2015 at 8:53 AM, Thomas Weigert <[email protected]>
wrote:

> I am wondering whether it is possible to generate ambiguous parses with
> the help of an external lexer.
>
> I have the following situation: Upon a rejection event, I am cleaning up
> in the lexer to be able to continue the parse. However, there are two pairs
> of ruby slippers I can use. What I would like to do is not to arbitrarily
> choose one pair and continue the parse, but to use both pairs to continue
> both parses, potentially resulting in a parse forest.
>
> From studying the manual and the available examples, I cannot see how to
> do this.
>
> I would greatly appreciate if anybody could advise whether this is
> possible, and if so, point me into the right direction.
>
> Thanks, Th.
>
>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to