The analysis stage of an IMP-to-PL/1 translator
John P Webby · Enlighten: Theses (The University of Glasgow) · 1973
This thesis describes the author's contribution towards the development of a program (written in PL/1) by which a user's program written in a syntactically correct form of the IMP language (as implemented by the Edinburgh Regional Computing Centre) may be translated into a program of the PL/1 language; the implied intention being that the latter shall have in general the same effect upon it's computational environment when run under the control of an IBM system/360 operating system (that includes the PL/l (F) compiler), as does the IMP source, The translator makes four passes of the IMP source text. The first pass is concerned mainly with lexical analysis. The second and third passes translate the IMP source text into a form known here as IMP(INT). IMP(INT) is an internal form of a subset of the IMP language augmented by statement-description markers. It is not directly related to the generation of a PL/1 object text. The fourth pass translates the IMP(INT) text into PL/1. It was the author's responsibility to program the second and third passes. Both of these passes (and the fourth pass) are controlled by a top-down syntax analyser. The methods used to analyse the syntax and perform most of the text transformations required during a pass are based on a syntax directed compiling technique noted by G. Millard. Various modifications and improvements to Millard's original algorithms made by the author are described within. During the second pass a text editor is used. This text editor was devised by the author and is also described within. The third pass constructs symbol tables. These tables are referenced during the third and fourth passes. A description of the construction of these tables and the methods used to access them is given. A number of programs designed to test all the characteristics of the translation to IMP(INT) have been successfully processed by the first, second and third passes. It is expected that the programming of the fourth pass will soon be completed, after which time an automatic translation from IMP to PL/l will be possible.