Automated translation of engineering codes into executable python using template-based LLM generation: an empirical study on korean design standards
Wonbok Lee, Yoonjae Sung, Hyunwoo Lee, Justin K W Yeoh, Bonsang KooAbstract
This study presents KDS2Code, a practical workflow for automatically translating engineering codes, specifically Korean Design Standards (KDS), into executable Python implementations to support BIM-based Automated Code Checking (ACC). The proposed approach integrates hierarchical document parsing, table recognition, hybrid rule identification using regex-based filtering and LLM-based semantic classification, template-constrained code generation, and multi-level validation. A key feature is the separation of computational and non-computational clauses, enabling the extraction of implementable computational rules from text-based standards. The method was evaluated on four KDS 11 geotechnical and foundation-related documents. Across the evaluation set, 45 computational rules were identified and translated into Python implementations. Among them, 14/17 ground-truth (GT) rules achieved reference-based functional agreement. Separately, the 28 newly discovered rules achieved 27/28 initial and 28/28 corrected smoke-test passes. All generated implementations achieved structure validity, and no aggregated correctness rate was reported. The results indicate that remaining discrepancies mainly arise from ambiguity in engineering standard specifications rather than syntax, structure, or runtime failures. Overall, KDS2Code demonstrates an initial step toward scalable engineering-standard-to-code translation for digitalizing engineering standards in ACC applications.