• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

J4 ›› 2006, Vol. 28 ›› Issue (6): 131-134.

• 论文 • Previous Articles     Next Articles

  

  • Online:2006-06-01 Published:2010-05-20

Abstract:

In this article we propose a method for quickly constructing an assembler, The method has the following features: it uses lex and yacc to generate the lexer and parser of an assembler respectively; an instruction exists as an internal representation in the assembler; the instructions' encoding infor rmation is saved in the data tables, when encoding an instruction a generic procedure is employed to search these tables to decide on its encoding forma t, and then a corresponding encoding function is called to produce its machine code. An assembler constructed using this method is easily modifiable. Fi nally we describe the application of this method when implementing a VLIW DSP' assembler.

Key words: assembler, construction, VLIW