Closed
Description
What happened?
Replacing the "FIXME" strings in https://gist.github.com/hoehrmann/f234c1156ee5ef7b24cb589c14aaefda?permalink_comment_id=5070379#gistcomment-5070379 by the empty string makes llama.cpp see left recursion that is not in the original grammar, presumably due to how it rewrites repetition into recursion. The basic construct is
a ::= "a" ( "" | ... )*
In case of the grammar above, the empty alternative does not add anything to the grammar since it is under a zero-or-more repetition anyway. It would be nice if the grammar rewriter would lift the empty string out of the alternatives and adjust the quantifier if necessary before rewriting this into recursion.
Name and Version
version: 2891 (9a17ab9)
built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
What operating system are you seeing the problem on?
Linux
Relevant log output
...
terminate called after throwing an instance of 'std::runtime_error'
what(): unsupported grammar, left recursion detected for nonterminal at index 30
Aborted (core dumped)