lilt icon indicating copy to clipboard operation
lilt copied to clipboard

Technically correct hanging behavior

Open Quelklef opened this issue 7 years ago • 1 comments

With

alpha: <abcdefghijklmnopqrstuvwxyz>
word: *alpha *" "
sentence: *word

feeding "." to sentence will hang.

This is technically correct behavior. Note that * is a macro for ?+. So sentence will repeatedly (due to the +) call word. Word will try to call alpha, which wont match. word will not fail but instead return "" (due to the ?). The head has not changed, and we're back at sentence, which will repeatedly call word forever, since it never fails but never changes the head.

I don't know a good solution to this at the moment. One possible one is for Optional to fail if the inner rule doesn't change the head, but that feels like it would have negative side effects.

Quelklef avatar Jan 20 '18 22:01 Quelklef

Should be allowed but would be nice if an error message were displayed when something like this happened

Quelklef avatar Feb 12 '18 15:02 Quelklef