A Method for Quickly Constructing an Assembler and Its Application
HU Ding-lei · Computer Engineering and Science · 2006
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 information is saved in the data tables, when encoding an instruction a generic procedure is employed to search these tables to decide on its encoding format, and then a corresponding encoding function is called to produce its machine code. An assembler constructed using this method is easily modifiable. Finally we describe the application of this method when implementing a VLIW DSP’s assembler.