An Experiment with a Self-compiling Compiler for a Simple List-processing Language
暂无分享,去创建一个
Publisher Summary This chapter presents an experiment with a self-compiling compiler for a simple list-processing language. During the compilation process, successive lines of the program, that is, statements, are scanned and compared successively with a series of standard forms until a match is found. Variables are indicated in the standard form by a star, and when one of these is encountered during the scanning process, the corresponding symbol in the statement is placed in a stack. This stack plays a central part in the compilation process. Each standard form has an associated pro forma list of machine orders, or machine code translation, which represents its translation into machine orders. The translation of a statement is performed by a machine code routine known as COMPILE, which copies out the machine code translation with appropriate substitution of variable addresses taken from the stack. As the statements that the compiler can handle are defined by means of the standard forms and the machine code translation of machine orders, there is no particular need to keep their number down to the absolute minimum.