摘要
通过分析三种常见文法的利弊,采用了扩展的BNF文法进行文本语法规则的描述,并通过准引用(qua-si-quote)和语法糖方法对该文法进行了改进和扩充,增强了文本语法的描述能力和易用性。通过准引用方法,已经被建立好的文本语法元素的抽象语法能够被重用来构造新的语法元素。通过使用语法糖,新的语法构件能被转换到存在的语法构件上。当元模型在实例上执行计算或编译时,可以通过脱糖(desugar)转换操作,建立一个新的语法类的实例。
This paper analyzed three common grammar' s advantages and disadvantages, and adopted extreme BNF as the description of the text concrete syntax regulation. Furthermore quasi-quote and syntactic sugar were used to improve and extend the grammar and also enhance the description and usability of the text concrete syntax. With the quasi-quote mechanism, the abstract syntax of text concrete syntax element which had been built by the system could be reused to construct new syntax element. New syntax element could be constructed by transform to existing element with the syntax sugar. The desugar operation performs to create an instance of a new syntax category when the metamodel was computing or compiling on the instance.
出处
《计算机应用研究》
CSCD
北大核心
2008年第3期791-794,共4页
Application Research of Computers
基金
国家科技攻关项目(2004BA907A20)
吉林省重大科技项目(20040304)