DeAI Research
Source · Procedia Computer Science

Text2DSL: LLM-Based Code Generation for Domain-Specific Languages

2026Alexander V. Kozachok; Alexander M. Nazimov; Шамиль Магомедов

cid 414dbd110d8711b9f0397cb9efdc26b60ea0e07cedc55c8ec4182ace2666a50b · original · open access · via openalex

Title: Text2DSL: LLM-Based Code Generation for Domain-Specific Languages
Authors: Alexander V. Kozachok; Alexander M. Nazimov; Шамиль Магомедов
Venue: Procedia Computer Science
Year: 2026
Canonical: doi:10.1016/j.procs.2026.09.361
URL: https://doi.org/10.1016/j.procs.2026.09.361
Collector: openalex
OA: true

ABSTRACT
Domain-specific languages (DSLs) are widely used for managing operating system security policies, yet manually authoring rules in such languages demands high expertise and is error-prone. This paper formalises the task of automatic DSL code generation from natural language descriptions — Text2DSL — as a distinct problem class, separate from Text-to-SQL and general-purpose code generation. We introduce the PolkitBench dataset comprising 4,204 verified natural-language–to–Polkit-rule pairs, each validated through a three-level AST-based pipeline. Controlled prompt experiments on two MoE models of different scale and provenance — GigaChat-10B-A1.8B (1.8B active parameters) and Nemotron-3-Nano-30B-A3B (3B active) — demonstrate the critical role of structured context (BNF grammar, API specification, permitted identifier vocabulary) for LLM-based DSL code generation. Across both models, supplying context raises syntactic validity to 98.6–99.4%, structural validity by +9.7 to +35.5 pp, and the CodeBLEU score by +60% to +95%. The consistency of the effect across models of different scale and provenance indicates that, for the Text2DSL class of problems, injecting a formal target-language specification into the prompt context is a robust enabling factor for high-quality generation without model fine-tuning.