%token NUM = /(\d+)/ %token OP = /([-+*\/])/ %{ my $nxs = 0; %} %conflict isInTheMiddle { $nxs++; if ($nxs == $self->YYVal('ExpList')) { print "Reducing by :MIDx\n"; $self->YYSetReduce(':MIDx' ); $nxs = 0; } else { $self->YYSetShift() } } %explorer isInTheMiddle 'ExpList' %% T: %isInTheMiddle? S ; S: x %PREC isInTheMiddle S x | %name :MIDx x %PREC isInTheMiddle ; x: NUM | x OP NUM ; %% =head1 SYNOPSIS This grammar is similar to the one in file C. It can't be parsed by LR(k) nor LL(k) algorithms. Backtracking LR and GLR algorithms can but will perform poorly. Compile it with: $ eyapp -P ExpList.eyp $ eyapp -TC noPackratSolvedExpRGconcept.eyp Run it with: $ ./noPackratSolvedExpRGconcept.pm -t -i -m 1 -c '2-3 3*4 5+2' =head1 SEE ALSO Files C, C, C =cut