Closed timobaumann closed 4 years ago
the fix for #199 will need to be extended to cover this once the left-recursion check is implemented.
GrammarTest.groovy already contains a check for left recursion. The parser at present returns null for left-recursive grammars that require left recursion as part of their parse (whereas grammar creation works fine). I believe a left recursive grammar itself should not be allowed (because it's useless: when left recursion is required for the derivation, the parse will fail). Any thoughts, @alexanderkoller ?
there's already a Grammar.check()
which does what we need. how convenient.
fixed. it remains to localize the error messages that were already created. That's a different issue, though.
in the old days, some-commercial-ASR-plugin would crash if confronted by a left-recursive grammar. Sphinx does not crash but yields incredibly bad results (I believe it unrolls the recursion until the search beam is completely filled and has too little space for reasonable stuff left on the search beam). I believe all speech recognizer plugins will have similar issues with left-recursion.
The DialogOS grammar implementation needs a checker for left-recursion so that we can shoot a reasonable exception in this case, rather than yielding unexplainable behaviour.