There are also a couple of examples in Marpa::R2 test suite with internal scanning (lexeme_alternative() is used in external scanning, as in the examples provided by Jeffrey) -- ambiguous lexemes as defined as multiple RHS alternatives on a lexical rule with the same LHS, e.g.:
NNS ~ 'shoots' | 'leaves' VBZ ~ 'eats' | 'shoots' | 'leaves' https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/t/sl_panda1.t IN ~ 'like' VBP ~ 'like' NN ~ 'time':i VBP ~ 'time':i — https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/t/sl_timeflies.t You can then use Marpa::R2::ASF interface to build/prune a parse forest or tree (sl_panda1.t) or just enumerate the parse trees (sl_timeflies.t). On Mon, Jul 20, 2015 at 6:26 PM, Thomas Weigert <[email protected]> wrote: > I am trying to figure out how I can create, from within an external > scanner, an ambiguous parse. What I want to achieve is this: I get fed an > event from marpa, and now in the code handling this event I will need to > recognize the matched symbol as two different lexemes, each causing a > different parse to result. > > From the documentation it seems that I could call lexeme_alternative() > twice, once for each lexeme I want to create. But, alas.... > > Could you please point me to an example where somebody has successfully > done something like this? > > In summary, I hope to, in a pause look at the expected symbols. If I find > that certain symbols are expected, create a parse for each of them, > resulting in a parse forest. (In fact, I know already that one of the > alternatives will die later, but at this point, I do not yet know which.) > > 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.
