Re: A problem with calling ambiguous() and ambiguity_metric()

2014-10-01 Thread Jeffrey Kegler
No, ambiguity is *not* always a fatal error. I'll have to update the docs to warn the reader that when it is not, and when the ambiguous() method detects ambiguity, the application will need to series_restart() before calling value(). -- jeffrey On 09/30/2014 10:56 PM, Ron Savage wrote: Is

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
On Wednesday, 1 October 2014 15:17:34 UTC+10, Jeffrey Kegler wrote: > > OK. Ambiguity is a property of the parse (grammar + input). Typically > you'll only check for it once the input is complete. So checking inside > the read()/resume() loop is not something you'll typically do, because the

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
Thanx. -- 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 marpa-parser+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
Is ambiguity always a fatal error? I realize the libmarpa does not force that, but are you saying the user should automatically assume that's the case? -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop rec

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Jeffrey Kegler
OK. Now I understand. The $slr->ambiguous() method, in producing its diagnosis of the ambiguity, is assuming you'll treat an ambiguity as a fatal error, and won't go on to call value(). At the very least, I should document this. -- jeffrey On 09/30/2014 10:22 PM, Ruslan Shvedov wrote: I've

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ruslan Shvedov
I've added a couple of series_restart() calls to your gist, see https://gist.github.com/rns/0371dfcffa6887f4e5a2 to avoid exceptions. The test output makes is arguably more useful that way. On Wed, Oct 1, 2014 at 8:01 AM, Ron Savage wrote: > I've switched over to gists because they allow comment

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Jeffrey Kegler
OK. Ambiguity is a property of the parse (grammar + input). Typically you'll only check for it once the input is complete. So checking inside the read()/resume() loop is not something you'll typically do, because the interim values will be for the input so far -- not the input at the point wh

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
I've switched over to gists because they allow comments: https://gist.github.com/ronsavage/a372ca2802f47808374b As for desired behaviour, you'll note cases 0 & 4 print "Output: !->! OK count: 2." This means the parse is correct, which is true. So why don't all cases do that? I accept there cou

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Jeffrey Kegler
Thanks. If I had to guess, things are behaving as documented and the issue is that the way you're going through the loop is resulting in behavior you don't expect. But that is just a wild guess and once I see more, I'll know more. FWIW I have exercised the logic in question a lot, because it

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ruslan Shvedov
On Wed, Oct 1, 2014 at 6:37 AM, Jeffrey Kegler < jeffreykeg...@jeffreykegler.com> wrote: > My guess is that $slr->series_restart() is not really related to the > original question, but I can't really know from the description so far. > Calling $slr->series_restart() before value() would help prev

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
I'll cut down the big program. I can see how to call the same code twice, with the same input but a different value for a new parameter which exercises the calls in question. -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ruslan Shvedov
On Wed, Oct 1, 2014 at 6:25 AM, Ron Savage wrote: > Presumably that means call series_restart() after ambiguous() but before > value(), right :-)? > :)) Yes. > -- > You received this message because you are subscribed to the Google Groups > "marpa parser" group. > To unsubscribe from this grou

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Jeffrey Kegler
My guess is that $slr->series_restart() is not really related to the original question, but I can't really know from the description so far. On 09/30/2014 08:25 PM, Ron Savage wrote: Presumably that means call series_restart() after ambiguous() but before value(), right :-)? -- You received t

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Jeffrey Kegler
Before $slr->read() there is no input and therefore no parse, just a recognizer. So $slr->ambiguous is undefined. As for the rest, I don't have enough context to see what's going on - I'm not sure anything is wrong. Could you give as small an example as possible where something is happening

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
Presumably that means call series_restart() after ambiguous() but before value(), right :-)? -- 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 marpa-parser+unsubs

Re: A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ruslan Shvedov
Perhaps, something like this: If you need to call value() after ambiguous(), make sure to call series_restart() first. would make the things clearer. On Wed, Oct 1, 2014 at 5:33 AM, Ron Savage wrote: > The docs for Marpa::R2::Scanless:R say, for ambiguous(), "This method > should be called a

A problem with calling ambiguous() and ambiguity_metric()

2014-09-30 Thread Ron Savage
The docs for Marpa::R2::Scanless:R say, for ambiguous(), "This method should be called after the read() method." I think that should be somehow clarified. Consider this code (BTW the parse is ambiguous): for ( my $pos = $self -> recce -> read(\$string); $pos < $length; $pos = $self -> recce -> r