lilt
lilt copied to clipboard
Technically correct hanging behavior
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.
Should be allowed but would be nice if an error message were displayed when something like this happened