摘要
通过对编译系统进行面向对象分析,探讨了基于类库的编译器构造方法。在抽取语言文法基本结构的基础上,构造了可复用的编译基本类。编译基本类模型以语法单元为单位,集编译过程中词法分析、语法分析、语义处理、优化和执行等操作与一体,打破了传统编译器中各个编译阶段的空间分割。在基于类库构造的编译器中,对符号表做了类化处理并采用了动态的多级结构,同时将语言语法和语义的处理相分离。提高了编译成份的可扩展性、可复用性和可维护性。
Object-oriented analysis of the compiler domain was used to construct a compiler using a compiler class lib rary. The basic grammar structures were modeled by the basic compiler classes an d the compiler front end architecture. All compilation phases, including lexical analysis, parsing, semantic handling, optimization and execution, are integrate d into the class model of a syntax unit. This eliminates the space split of diff erent compilation phases in traditional compilers. In this approach, the symbol tables are abstracted as classes, using dynamic multiple levels of structures. T he syntax analysis and semantic operations are handled separately, which greatly increases the extensibility, reusability and maintainability of compilation com ponents.
出处
《清华大学学报(自然科学版)》
EI
CAS
CSCD
北大核心
2003年第7期964-967,共4页
Journal of Tsinghua University(Science and Technology)
基金
国家自然科学基金资助项目(60083004)
国家教育振兴计划项目