The Object Oriented design of TTCN-3 Compiler Based on ANTLR

Wei Wei · Control Engineering of China · 2012

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.

Read the paper · More papers on PaperTik