AFAICT, everything is behaving as specified.

I suggest you look at the parses by throwing
:default ::= action => [name,values]
into the grammar, and then adding a dump of the values
while (my $value = $recce->value()) {
  print "Value: ",Dumper($value);
}
immediately after you dump the events. I tried this and your results, your grammar and your events seem to match. (By the way, this value dump also shows that your grammar is ambiguous.)

I assume they do *not* match what you intended, otherwise you wouldn't be posing the question. My suggestion -- before working with events, using dumps of the parse trees to ensure that your parse trees look like what you think they should look like. Then add the events.

As a guess at where the grammar is departing from your intention, "Notation ::= L argRule", requires the <L> to be followed by an <argRule>. The <argRule> is being recognized as a <Presentation>, and this is eating up the second "<mi>L</mi>", so that it does not form part of a <Notation>. All this might be clearer from a dump than it is from my explanation.

I hope this helps, jeffrey

On 08/06/2014 03:28 PM, Ion Toloaca wrote:
Hello everyone!

I would be very thankful if someone would help me understand what happens in my code,
which I have been failing to do for quite a few days.

Here is the simplified version of the grammar I'm working on.
https://github.com/itoloaca/Notation-Based-Parsing/blob/master/My_Grammar.pm
and this is the code that uses it can be found here:
https://github.com/itoloaca/Notation-Based-Parsing/blob/master/test123.pl

The input is: "<mrow><mi>L</mi><mi>L</mi></mrow>"
The output is:
Actual events: $VAR1 = [
          [
            16,
            10,
            'Notation'
          ]
        ];
Which means that 'Notation' was found only as the second <mi>L</mi>,
while I would expect [ [6, 20]] - meaning the 2 symbols <mi>L</mi><mi>L</mi>.

There are a lot of peculiarities I found - for example replacing argRule with Expr makes it work right, also removing <mrow> tags or even simply switching the order
of the elements of "Notation ::= L argRule" to "Notation::= argRule L"
makes it once again work right.
Since using events is a basic point in my project - I can't help but wonder what is that I don't know about the way these work that triggers these strange phenomena. Therefore, please help me understand events (a link to an appropriate tutorial would
be nice... I just can't figure it out from the documentation).

Thank you in advance for your help.

Best regards,
Toloaca Ion
--
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] <mailto:[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