作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2006, Vol. 32 ›› Issue (4): 49-51,54.

• 软件技术与数据库 • 上一篇    下一篇

面向上下文无关语言的信息提取模块化设计

高海昌1,刘晓洪1,冯博琴1,朱利 2   

  1. 1. 西安交通大学电子与信息工程学院,西安 710049;2. 西安交通大学软件学院,西安 710049
  • 出版日期:2006-02-20 发布日期:2006-02-20

Design of Information Extracting Modularization for Context-free Languages

GAO Haichang1, LIU Xiaohong1, FENG Boqin1, ZHU Li2   

  1. 1. School of Electronics and Information Engineering, Xi’an Jiaotong University, Xi’an 710049;2. School of Software, Xi’an Jiaotong University, Xi’an 710049
  • Online:2006-02-20 Published:2006-02-20

摘要: 为实现白盒测试的源文件信息提取,提出了通过Lex 和Yacc 对使用上下文无关文法定义的语言进行词法和语法分析,构建独立的信息提取模块的思想。在函数信息提取部分提出了块和级的概念,用语句结构和语句链表结构将函数定义信息表示出来。在类信息提取部分通过识别出类声明中的成员变量和成员函数的声明信息,建立成员链表结构;识别类声明信息,建立类结构。然后将这些结构信息存入数据库,以供后续模块使用,充分做到了模块独立性和可重用性。这样只需要设计不同的信息提取模块,就可以将目前已经实现的面向C/C++语言的软件测试工具WBoxTool 推广应用到其它面向上下文无关文法的语言。

关键词: 白盒测试;上下文无关文法;函数;类;成员链表

Abstract: Lex and Yacc are used to analyze the Lexis and grammar of the languages defined by context-free grammars, and an independent information extracting module is built to extract the information of source files for white-box testing. The whole grammar system for a tested language accorded with the criterion of Yacc is built, and the system is logically divided into two primary parts, class grammar and function grammar. Sentence structure and sentence linked list structure express the function definition using block and level when they extract function information. The structure information is put into the database to be used for other modules, thus the modules are completely independent. In this way, only need to design different information extraction modules, various context-free grammar languages for white-box testing can be realized

Key words: White-box testing; Context-free grammar; Function; Class; Member linked list