{"title":"New built-in tools for extending the Planning C language","authors":"V. V. Pekunov","doi":"10.7256/2454-0714.2022.1.37240","DOIUrl":null,"url":null,"abstract":"\n In this paper, the problem of developing language extensions of Planning C (a dialect of C++) is considered. The review of existing external programs and solutions built into languages that allow translating new constructions introduced into the language into the output code is carried out. Based on the analysis, it is concluded that the most natural solution built into the language will be some combination of improved regular expressions (to highlight new constructions) with code generators based on procedural and syntactic macros. At the same time, it is advisable to use elements of direct logical programming (both in macros and in regular, more precisely, regular-logical expressions). The proposed approach makes it possible to more flexibly allocate replaceable constructs in comparison with template approaches and more simply replace them with output code in comparison with approaches based on manipulations with the syntax tree. The syntax and semantics of the proposed solutions are described. A preprocessing scheme is proposed that implements the selection of initial constructions by scanners (groups of parameterized regular logical expressions) and their replacement with output code implemented by deductive macromodules (with possible multiple matching). This scheme allows you to work with arbitrary input and output syntaxes and provides prompt input of new constructions into Planning C, which is especially valuable, for example, when prototyping new extensions. The paper contains information about the successful testing of the proposed approaches (on the development of a number of syntactically non-trivial extensions of Planning C).\n","PeriodicalId":155484,"journal":{"name":"Программные системы и вычислительные методы","volume":"49 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Программные системы и вычислительные методы","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.7256/2454-0714.2022.1.37240","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
In this paper, the problem of developing language extensions of Planning C (a dialect of C++) is considered. The review of existing external programs and solutions built into languages that allow translating new constructions introduced into the language into the output code is carried out. Based on the analysis, it is concluded that the most natural solution built into the language will be some combination of improved regular expressions (to highlight new constructions) with code generators based on procedural and syntactic macros. At the same time, it is advisable to use elements of direct logical programming (both in macros and in regular, more precisely, regular-logical expressions). The proposed approach makes it possible to more flexibly allocate replaceable constructs in comparison with template approaches and more simply replace them with output code in comparison with approaches based on manipulations with the syntax tree. The syntax and semantics of the proposed solutions are described. A preprocessing scheme is proposed that implements the selection of initial constructions by scanners (groups of parameterized regular logical expressions) and their replacement with output code implemented by deductive macromodules (with possible multiple matching). This scheme allows you to work with arbitrary input and output syntaxes and provides prompt input of new constructions into Planning C, which is especially valuable, for example, when prototyping new extensions. The paper contains information about the successful testing of the proposed approaches (on the development of a number of syntactically non-trivial extensions of Planning C).
本文研究了编程语言Planning C (c++的一种方言)语言扩展的开发问题。对现有的外部程序和内置语言的解决方案进行审查,这些程序和解决方案允许将引入语言的新结构翻译成输出代码。根据分析,得出的结论是,该语言中最自然的解决方案将是改进的正则表达式(以突出显示新的结构)与基于过程和语法宏的代码生成器的某种组合。同时,建议使用直接逻辑编程的元素(包括宏和正则,更准确地说,正则逻辑表达式)。与模板方法相比,所提出的方法可以更灵活地分配可替换的结构,与基于语法树操作的方法相比,可以更简单地用输出代码替换它们。描述了所提出的解决方案的语法和语义。提出了一种预处理方案,通过扫描器(参数化正则逻辑表达式组)实现初始结构的选择,并将其替换为演绎宏模块实现的输出代码(可能有多次匹配)。该方案允许您使用任意的输入和输出语法,并为Planning C提供新结构的快速输入,这尤其有价值,例如,在对新扩展进行原型设计时。这篇论文包含了关于所建议的方法的成功测试的信息(关于计划C的许多语法上重要的扩展的开发)。