Here are some more details:

I just copied the example script from the synopsis section and changed the 
$input:

#!perl

use strict;
use warnings;
use Marpa::R2;
 
my $dsl = <<'END_OF_DSL';
:default ::= action => [name,values]
lexeme default = latm => 1
 
Expression ::= Term action => ::first
Term ::=
      Factor action => ::first
    | Term '+' Term action => do_add
Factor ::=
      Number action => ::first
    | Factor '*' Factor action => do_multiply
Number ~ digits
digits ~ [\d]+
:discard ~ whitespace
whitespace ~ [\s]+
END_OF_DSL
 
my $grammar = Marpa::R2::Scanless::G->new( { source => \$dsl } );
my $input = '1 + 1 + 1';
my $value_ref = $grammar->parse( \$input, 'My_Actions' );
 
sub My_Actions::do_add {
    my ( undef, $t1, undef, $t2 ) = @_;
    return $t1 + $t2;
}
 
sub My_Actions::do_multiply {
    my ( undef, $t1, undef, $t2 ) = @_;
    return $t1 * $t2;
}

The result looks like this:

Parse of the input is ambiguous
> Length of symbol "Term" at line 1, column 1 is ambiguous
>   Choices start with: 1
>   Choice 1, length=5, ends at line 1, column 5
>   Choice 1: 1 + 1
>   Choice 2, length=1, ends at line 1, column 1
>   Choice 2: 1
> Marpa::R2 exception at 
> D:\Users\root\Documents\Perl\Skripten\Marpa\synopsis.pl line 26.
>


I also found this blog post but I didn't get to work it so far: 
http://blogs.perl.org/users/jeffrey_kegler/2012/08/precedence-parsing-made-simpler.html


-- 
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