This document is a manually-assisted OCR transcription of: http://history.dcs.ed.ac.uk/archive/docs/EMAS_Manuals/IMP/A_Syntactic_and_Semantic_Definition_of_the_IMP_Language.pdf Edinburgh Regional Computing Centre A Syntactic and Semantic definition of the IMP Language As implemented by the Edinburgh Regional Computing Centre by P.D. Stephens First edition August 1974 A SYNTACTIC AND SEMANTIC DEFINITION OF THE IMP LANGUAGE AS IMPLEMENTED IN THE ERCC. PREFACE This reference manual describes the IMP language as implemented by the Edinburgh Regional Computing Centre on its service computers, a twin ICL 4-75 interactive system operating under the Edinburgh Multi-Access System (EMAS) and an IBM 370/158 batch system, in a more formal manner than the Edinburgh IMP Language Manual (2nd edition). It replaces Part II, Chapters 8 and 9 of the first edition of the IMP language manual (July 1970). The information has been brought up to date with the current release 8 of the IMP compiler. The syntax of the IMP language is presented in Section 1 and its semantics in Section 2. Section 3 contains lists of the compile time and run time fault messages generated by the compiler. The reader is referred to the other two documents which describe facilities of the IMP language; The Edinburgh IMP Language Manual (2nd Edition), and The IMP/FORTRAN System Library Manual. The editors would like to thank Mrs Anne Tweeddale who typed this manual. Andrew McKendrick, Gillian T. Watson, July 1974. SECTION 1 - SYNTAX INTRODUCTION The syntax describes in phrase-structure notation the structure of the various forms of statement which are allowed in the language. The notation used is as follows. A definition is started by P (for PHRASE), and ended by a semi-colon. The symbols '<' and '>' are used to enclose definable items in the IMP language. They stand for themselves ('less than' and 'greater than' respectively) whenever they enclose any character which is not an upper or lower case letter, or a space or prime. The sequence '::=' separates an item from its definition and may be interpreted as 'is defined as'. The character '|' is used to separate alternative definitions and may be interpreted as 'or'. Symbols used in a definition but not enclosed by '<' and '>' denote actual IMP text, i.e. literals. For example, the phrase structure definition of 'assignment operator' is: P::= ==|=|<-|->; The phrase structure definition of 'name list' is: P::= ; P::= ,| denotes the null text, i.e. P::= ; Spaces are ignored everywhere in a program unless the compiler is operating in text mode. The convention used is that, if there is a null alternative, the words 'rest of' will appear immediately after the '<' in the definition. A prime immediately before the '>' of a phrase also denotes a null alternative. P::= +|-|~|; is termed a built-in phrase and has not been expanded further in terms of literals or phrases. Such built-in phrases are described in detail at the end of the phrase structure. IMP PHRASE STRUCTURE All IMP source statements belong to the class P, where SS stands for source statement, as defined below. P::= | %THEN| | | %THEN| %CYCLE| | %CYCLE| %REPEAT| | %ARRAY| | %ARRAY| %SWITCH| %SPEC| %SPEC| | %BEGIN| %END| %ENDOFPROGRAM|