On Sun, Oct 09, 2005 at 12:41:18PM -0700, Patrick R. Michaud via RT wrote: > On Tue, Oct 04, 2005 at 09:16:58PM -0700, Joshua Hoblitt via RT wrote: > > Guys, > > > > What is the status of this bug? Should this be a PGE todo item? > > My opinion is that it's "not a bug" -- the normal behavior for > most programs with infinite recursive loops is that they > eventually explode. The original set of rules were > > rule atom { A } > rule binary { <expr> \* <atom> } > rule expr { <binary> } > > which is analogous to writing something like > > sub atom { print "A"; } > sub binary { expr(); print "*"; atom(); } > sub expr { binary(); } > > and most people would consider "explode" to be, well, if not correct, > at least not a bug in the language translator.
Sounds reasonable. I'm sure it would be nearly impossible to catch all possible cases of infinite recursion when the grammar is compiled but how difficult would it be to trap at runtime? A simple warning along the lines of "Warning: production foo has recursed 10,000 times without matching any terminal\n" would certainly be useful in figuring why it blew up... -J --
pgpKbTL9iYw1u.pgp
Description: PGP signature