llama.cpp b10618 Fixes Tool-Call Grammar Parsing Bug
The llama.cpp project released version b10618, which fixes a bug where escaped hyphens (\-) in character classes were rejected by the grammar parser. This bug previously caused automatically generated tool-call grammars to fail during parsing. This release ensures reliable structured outputs and tool calling, which are critical for agentic workflows and integrating LLMs with external APIs. Without this fix, developers using grammar-constrained decoding for tool use could experience unexpected runtime failures. The issue stemmed from a mismatch where gbnf_escape_char_class() escaped hyphens as \-, but parse_char() rejected the escape sequence. The patch resolves this by accepting \- as a literal hyphen within character classes.
## BACKGROUND
llama.cpp is a popular open-source framework for running LLMs locally with high performance. It supports GBNF (GGML Backus-Naur Form), a grammar format used for constrained decoding to force LLM outputs into specific formats like JSON or tool calls. Character classes in grammars define sets of acceptable characters, similar to regular expressions.