检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
出 处:《控制工程》2012年第S1期122-125,共4页Control Engineering of China
基 金:国家科技支持计划"高速列车网络控制系统"资助(2009BAG12A06)
摘 要:针对TTCN-3核心语言的编译问题,设计了一种基于ANTLR的TTCN-3核心语言编译器。在语法分析器的设计中引入面向对象的设计方法,充分发挥了ANTLR面向对象的特性,构造了可复用的语法分析基类,降低了语法规则的相互耦合性和分析代码的复杂性,并实现了语法分析和语义分析的分离;同时,对符号表也做了面向对象的类化处理,并采用散列形式表现。另外,符号表可以动态地删除不在作用域范围内的标识符和添加进入作用域的标识符,取消了符号表的多级作用域结构,简化了符号表的构建和管理,这不仅减少了编译器的开发周期,提高了代码的可复用性,而且增强了工程的可维护性和可扩展性,最后,设计了编辑器语义分析的算法流程。实验测试证明,该编译器能够快速、正确的检测出TTCN-3核心语言程序中的词法、语法错误以及语义错误。Aimed at the compilation problems of TTCN -3 core language,a compiler used to compile the language is designed based on ANTLR.The object -oriented(00) designing method is introduced in the design of parser analyzer so as to make full use of the 00 characteristics of ANTLR.In the design of parser analyzer,a reusable base class is constructed to reduce the coupling between the grammar rules and the complexity of the code,thus realizing the separation of syntax analysis and semantic analysis.Besides,the token map is processed in 00 class mode and hash map form.And the dynamic operations of the token map,such as deleting and adding tokens, are realized to eliminate the multi - level structure of token map and simplify the construct and management of token map,which not only reduce the developing cycles and improve the reusability of the code,but also enhance the maintainability and scalability of the project.Finally,the semantic analysis algorithms are designed.Experimental tests show that the compiler is able to check the lexical, grammatical and semantic errors in the TTCN - 3 core language based program quickly and correctly.
关 键 词:测试和测试控制表示法 语言识别的另一个工具 面向对象 编译器
分 类 号:TP314[自动化与计算机技术—计算机软件与理论]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.166