Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ PrefaceContents1. Introduction2. Syntax rules3. Tree building4. Code rules5. Labels6. Arithmetic statements7. Symbol table8. Using TREE-META on the 1906A9. The TREE-META systemAppendices
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureICL 1906A manualsTree-Meta
ACLLiteratureICL 1906A manualsTree-Meta
ACL ACD C&A INF CCD CISD Archives
Further reading

Preface
Contents
1. Introduction
2. Syntax rules
3. Tree building
4. Code rules
5. Labels
6. Arithmetic statements
7. Symbol table
8. Using TREE-META on the 1906A
9. The TREE-META system
Appendices

8. USING TREE-META ON THE 1906A

8.1 Introduction

TREE-META on the 1906A is written using the implementation language, PLASYD [2]. No knowledge of PLASYD is necessary unless the user wishes to modify the system. TREE-META should be considered as a basic system which can easily be extended and, for this reason, it is provided in source form. TREE-META, and translators produced by it, are compiled and run using the TASK system on the 1906A [3]. Where possible, this uses the same formats as the standard ICL macros. However, TASK provides many extra facilities and overcomes most of the failings of the standard macros. Users of TREE-META should read at least the first part of the TASK manual.

8.2 Generating a Translator using TREE-META

The TREE-META compiler is kept in source code form in the file :SUBLIB.TREEMETA. The simplest method of using TREE-META is to input the TREE-META program to a filestore file, say TRNDEF. Assuming the user is logged in, the required translator can be generated by:

TASK PLASYD, *CR :SUBLIB.TREEMETA,#CR1 TRNDEF,#CP0 TRNPROG

This produces the translator, written in PLASYD, in the file TRNPROG. Using the notation of Section 1.2, the file TRNPROG consists of the two parts of the translator, SYPROG and COPROG.

This call of the TASK macro may also be included in a job deck or a macro definition. If input from MOP, the TASK macro will run a background job and return control to the user. This job will send broadcasts back to the user to inform him of its progress, and will send its output to the lineprinter.

The file, TRNPROG, is not the complete translator. It uses the library routines called SYLIB and CDLIB (see Section 1.2) which are kept in the file :SUBLIB.TREELIB in source code form. Thus the complete translator is the file :SUBLIB.TREELIB with TRNPROG appended to it.

8.3 Using the Translator

The translator generated by TREE-META is a PLASYD program which will compile programs in the defined language. If, for example, PROG is a file containing a program in the language defined, compilation is achieved by calling:

TASK PLASYD, *CR :SUBLIB.TREELIB,*CR TRNPROG,#CR1 PROG, #CP0 CMPROG

The compiled version of the program PROG is produced in the file CMPROG. It is for the user to decide the form that the compiled program will take and how it will be run. The standard limit for JOBTIME should be adequate for most compilers.

It is possible to define a translator, and compile a program using it, in a single command. For example:

TASK PLASYD, *CR :SUBLIB.TREEMETA~#CR1 TRNDEF,#CP0 TRNPROG,-
PLASYD,*CR :SUBLIB.TREELIB,*CR TRNPROG,#CR1 PROG,#CP0 CMPROG

Details of how to save a translator in binary form (rather than recompile each time) can be found in the TASK manual.

8.4 A Simple Example

Consider the following translator which has been input to the file SIMPLE:

.META SIMP 
SIMP = '.BEGIN' $ ( .ID '=' .NUM :ASGN[2] * ) '.END' ;
ASGN[-,-] => 'LOAD ' *2 ';' 'STORE ' *1 ';' % ;
.END

This would compile simple assignment statements for some unknown machine. A program in this language might be defined in the file PR as:

.BEGIN 
FRED = 3 
BILL = 5 
.END

To generate the translator and compile the program write:

TASK PLASYD,*CR :SUBLIB.TREEMETA,#CR1 SIMPLE,-
#CP0 SMPTR,-
PLASYD,*CR :SUBLIB.TREELIB,*CR SMPTR,-
#CR1 PR,#CP0 CMPR

The compiled program would be generated in the file CMPR as:

LOAD 3;STORE FRED; 
LOAD 5;STORE BILL;

8.5 Diagnostics

Both the TREE-META translator and the compiler generated by it, will stop on the first error encountered and issue the relevant diagnostic. Syntactic errors generate diagnostics in the form indicated in Section 2.3. A complete set of the possible diagnostics from TREE-META itself are given in Appendix 5. Those produced by the compiler will, of course, depend on the translator defined by the user. Diagnostics are output to the same file as the translator or compiled program. The last few lines of this file will, therefore, indicate the error encountered. A successful compilation or compiler generation will return to TASK with deleted OK while an error will return deleted ZZ.

If use is made of the facility for returning a false value from a Code Rule or arithmetic function, this will cause the diagnostic:

OUTPUT ERROR IN RULE

followed by the name of the relevant Code Rule.

If the user fails to include all the rules in the translator definition, the resulting PLASYD program will not compile. The diagnostics generated by the PLASYD compiler will indicate the rules that are missing. Due to the small number of forward references allowed in PLASYD, it is advisable in the case of large translator definitions, to input the Code Rules before the Syntax Rules.

The TREE-META library is capable of generating a number of system errors if tables overflow or incompatibilities arise during the translation. These diagnostics are of the form:

SYSTEM ERROR 3 IN

The complete set of diagnostics is given in Appendix 5. If the system error occurred during the syntax analysis, the relevant input line is printed with an indicator pointing to the position reached in the line. If the system error occurred while executing a Code Rule, the name of the relevant rule is printed.

The specific system error of stack overflow has the diagnostic:

STACK OVERFLOW IN

The remainder of the diagnostic depends on where the error occurred and has the same format as other system errors. Incorrectly formed tree nodes can be a cause of stack overflow.

⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site