Diagnosing CFG Interpretation in LLMs

Hanqi Li, Lu Chen, Kai Yu


Abstract
As LLMs are increasingly integrated into agentic systems, they must adhere to dynamically defined, machine-interpretable interfaces. We evaluate LLMs as in-context interpreters: given a novel context-free grammar, can LLMs generate syntactically valid, behaviorally functional, and semantically faithful outputs? We introduce RoboGrid, a framework that disentangles syntax, behavior, and semantics through controlled stress-tests of recursion depth, expression complexity, and surface styles. Our experiments reveal a consistent hierarchical degradation: LLMs often maintain surface syntax but fail to preserve structural semantics. Despite the partial mitigation provided by CoT reasoning, performance collapses under structural density, specifically deep recursion and high branching, with semantic alignment vanishing at extreme depths. Furthermore, Alien lexicons reveal that LLMs rely on semantic bootstrapping from keywords rather than pure symbolic induction. These findings pinpoint critical gaps in hierarchical state-tracking required for reliable, grammar-agnostic agents.
Anthology ID:
2026.findings-emnlp.294
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
6248–6263
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.294/
DOI:
Bibkey:
Cite (ACL):
Hanqi Li, Lu Chen, and Kai Yu. 2026. Diagnosing CFG Interpretation in LLMs. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 6248–6263, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Diagnosing CFG Interpretation in LLMs (Li et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.294.pdf