MECHANISM FOR EXPANDING PROGRAMMING LANGUAGE SYNTAX AT COMPILE TIME

Y.V. Berehuliak, R.V. Bachynskyi · Komp'ûternì sistemi ta merežì · 2025

The article examines the issue of the flexibility of grammars with a fixed set of rules, which limits the ability to integrate specialized syntactic constructs. A model for extending such grammars is proposed, allowing for modular supplementation of the base system with new rules without compromising its integrity. This approach enables the syntactic system to adapt to new requirements, ensuring the automatic expansion of formal descriptions. A mechanism for integrating new syntactic constructs has been developed, based on verifying their consistency using FIRST and FOLLOW set analysis. Additionally, methods for resolving ambiguities have been applied by utilizing the current parsing context, allowing the automatic determination of optimal rules for constructing an abstract syntax tree. This approach ensures the unambiguity and correctness of syntactic analysis, as even in cases of potential conflicts, the system eliminates ambiguity by considering local semantic and syntactic features. This approach demonstrates the high adaptability and modularity of the grammar extension mechanism, which is of significant practical importance for the further evolution of compilation systems and the development of specialized dialects. The proposed methodology opens new perspectives for the creation of flexible and scalable syntactic analysis systems capable of responding promptly to changes in modern programming requirements. Key words: compiler architecture, grammar, lexical analysis, syntactic analysis

Read the paper · More papers on PaperTik