Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > ddfdf0b0f2e10c06cbb5bbb1f4ee8dd8 > files > 198

perl-Parse-Eyapp-1.182.0-3.mga4.x86_64.rpm

%{

=head1 SYNOPSIS

See the grammar in file C<confusing.eyp> first.

This example illustrates how to solve the conflict using 
the postponed conflict resolution technique.

Compile the grammar with:

                 eyapp -TC confusingsolveddynamic.eyp

and execute it with:

                ./confusingsolveddynamic.pm -t -i -c 'x y c d'
                ./confusingsolveddynamic.pm -t -i -c 'x y c f'


=head1 SEE ALSO
 
=over 2

=item * The grammar in file C<confusing.eyp> 

=item * http://www.cs.man.ac.uk/~pjj/cs2121/ho/node19.html

=cut

%}

%semantic token 'c' 'd' 'f' 'x' 'y'
#%expect-rr 1

%conflict DORF {
  if (/\G(?=.*?d)/gc) { $self->YYSetReduce('XY:D' ); } else { $self->YYSetReduce('XY:F' ); }
}

%%
A: 
    %name Bcd
    B 'c' 'd' 
  | %name Ecf
    E 'c' 'f' 
;
B:  %name XY:D
    'x' 'y'       %PREC DORF
;
E:  %name XY:F
    'x' 'y'       %PREC DORF
;

%%