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

9. THE TREE-META SYSTEM

9.1 Introduction

TREE-META is a translator writing system. Consequently, it is capable of defining itself. The original system, of course, had to be defined in some other way. However, once a version of TREE-META was in existence, it was possible to redefine the translator in terms of itself. This definition is given in the file :SUBLIB.TREEDEF. A print-out of this file is given in Appendix 3. TREE-META can, itself, be compiled in the same way as any other translator:

TASK PLASYD,*CR :SUBLIB.TREEMETA,#CR1 :SUBLIB.TREEDEF,#CP0O :SUBLIB.TREEPROG

The TREE-META translator itself, uses the same standard set of library routines contained in :SUBLIB.TREELIB. Thus a new version of the system would be the two files :SUBLIB.TREELIB and :SUBLIB.TREEPROG. Assuming no changes have been made to the definition of the system since it was last compiled, the file :SUBLIB.TREEMETA ~ill consist of :SUBLIB.TREELIB with :SUBLIB.TREEPROG appended to it.

9.2 Augmenting TREE-META

TREE-META is a basic system which can easily be modified to suit a particular need. A sophisticated user can improve the system by adding to the library or by changing the syntactic form of the language. The more complex changes will require a complete understanding of the existing system. However, useful changes can be made with only an outline of the system.

Simple syntactic changes are straightforward. Consider, for example, an amendment which would allow assignment statements to be written in the form:

< A:=6 >

as well as the standard form:

< A<-6 >

The original form is defined by the Syntax Rule:

STHT = <- .ID '<-' EXPR :STOR[2] / UNION ;

Replacing this with:

STMT <- .ID ( '<-' / ':=' ) EXPR :STOR[2] / UNION ;

will produce the desired effect. If this new definition is stored in the file TREEDEF2 then the updated system can be generated by:

TASK PLASYD *CR :SUBLIB.TREEMETA,#CR1 TREEDEF2,#CP0 TREEPROG2

The revised system then consists of the two files :SUBLIB.TREELIB and TREEPROG2. It would now be possible to redefine the language TREEMETA2 making use of this additional facility by rewriting the file TREEDEF2 in terms of the symbol := rather than <-.

9.3 Modifying the Input Routine

The standard TREE-META input routine, %INCHR, reads 80 character lines from card reader stream 1 and passes them on one at a time. If a listing is required, the lines are printed as they are read.

Before each line, the character, whose internal code number is 63, is passed on to represent a newline character. Each line, therefore, generates 81 characters.

This input routine tends to be of use only if the language involved is free format. To generate a translator for a language which is field dependent, it is worthwhile modifying the standard input routine so that delimiters are inserted at the field boundaries.

9.4 TREE-META Data Structures

The basic set of library routines used by TREE-META and the compilers that it generates make use of a number of internal storage structures. In order to understand the system, a rudimentary knowledge of these is essential. The major items are:

STRING TABLE
all strings recognised by Syntax Rules and placed on the stack will be stored in the String Table. Each entry defines the type of string, its length and the individual characters in the string. The string type is defined as:
= 0 string added to stack by ↑ facility 
= 1 .ID string 
= 2 .NUM, .OCT, .HEX string 
= 3 .SR string
SYSTEM STACK
this is the run time stack of the system which is mainly used for storing subroutine exit addresses. It is possible to place a variety of items here temporarily.
STACK
items recognised in Syntax Rules are either placed on the stack or have a pointer to the item placed on the stack. Node building operations leave a pointer to the node on the stack. Entries are marked to indicate their type in the top character position:
= 0   .CHR, .LET, .DIG
= 2   label
= 4   .ID,.NUM,.OCT,.HEX pointer
= 8   pointer to string
= 16  pointer to tree node
NODE TABLE
contains all the tree nodes produced so far. Each entry consists of the name of the node, the number of branches and pointers to the individual branches.
SYMBOL TABLE
each entry consists of a pointer to the name of the item in the String Table followed by fields containing the values of LEVEL, TYPE and VALUE for this item. Items are stored in numerically ascending order.

The internal names for these main structures are:

During both the processing of Syntax Rules and Code Rules, a single Boolean variable, %MFLAG, will be set equal to the value true or false depending on the result of some test. This truth value is interrogated by a number of routines.

During the execution of Code Rules, a particular variable %CNODE always contains the name of the rule being obeyed. The system also makes use of the index register, X2, as an accumulator which either contains the result of some arithmetic operation or contains a pointer to a node being examined.

9.5 TREE-META Library

The TREE-META user only needs to know about the library routines if modifications are to be made to the basic system. Appendix 4 gives a brief indication of the action of each routine. This should be sufficient for a user to understand the definition of TREE-META given in Appendix 3. A full description of these routines can be obtained by looking at the source listing of :SUBLIB.TREELIB.

9.6 Inserting Code in the Translator

Code Rules tend to be more difficult to debug in TREE-META than Syntax Rules. It is possible to insert code into the middle of the translated Code Rule to aid debugging or to provide any non-standard code required by the user. A Code Rule of the form:

OER[-,-] => 'ABC' 'DEFGH' % ;

would generate code:

OER:
%BEGN;
%CNTCK;DATA(2);   checks node has two branches
%BF;DATA(@%Ll);
%OUTSR;DATA(3,"ABC");
%OUTSR;DATA(5,"DEFHG");
%OCR;
%Ll:
%END ;

Any PLASYD text can be added to this generated code by inserting it in the rule as a string preceded by the! symbol. For example:

OER[-,-] => 'ABC' ! 'DEBUG;' 'DEFGH' %

would separate the calls of OUTSR as follows:

%OUTSR;DATA(3,"ABC");
DEBUG;
7,OUTSR;DATA(5,"DEFGH");

The routine, DEBUG, has to be added to the TREE-META library. Whenever this rule is called, the routine DEBUG will be entered between the output of the two strings.

⇑ 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