
# Time-stamp: "2000-07-09 15:32:53 MDT"
use Parse::RecDescent 1.78;  $::RD_HINT = 2;
print 0 + defined Parse::RecDescent->
 new("  bub: 'b' | 'bb'    thang:  'a' bub 'c' ")->thang('a bb c');
 
 # Prints 0, because bub matched, but then thang failed; but it didn't
 # try going back into bub and matching another way, which WOULD have
 # caused thang to succeed.

# Cf:

print "\n", 'abbc' =~ m<^a(b|bb)c$>s, "\n";
 # prints "bb", showing backtracking, I think
print "\n", 'abbc' =~ m<^a(bbc|bb)c$>s, "\n";
 # prints "bb", definitely showing backtracking -- bbc succeeds,
 #  then that makes the larger expression fail, so it backtracks
 #  and tries the subexpression with just bb, and that succeeds,
 #  and then that makes the larger expression succeed
