VALGOL(ID:3932/val005)

ALGOL subset 


Val Schorre 1963 for Val's Algol

Small scale algebraic compiler written as a test of the META II compiler compiler projects.




Related languages
ALGOL 60 => VALGOL   Implementation
Meta II => VALGOL   Written using
VALGOL => foogol   Based on
VALGOL => VALGOL II   Superset

References:
  • Schorre, V. "Meta II: a Syntax Oriented Compiler Writing Language" view details Abstract: META II is a compiler writing language which consists of syntax equations resembling Backus normal form and into which instructions to output assembly language commands are inserted. Compilers have been written in this language for VALGOL I and VALGOL II. The former is a simple algebraic language designed for the purpose of illustrating META II. The latter contains a fairly large subset of ALGOL 60. The method of writing compilers which is given in detail in the paper may be explained briefly as follows. Each syntax equation is translated into a recursive subroutine which tests the input string for a particular phrase structure, and deletes it if found. Backup is avoided by the extensive use of factoring in the syntax equations. For each source language, an interpreter is written and programs are compiled into that interpretive language.
    Extract: Introduction
    META II is not intended as a standard language which everyone will use to write compilers. Rather, it is an example of a simple working language which can give one a good start in designing a compiler-writing compiler suited to his own needs. Indeed, the META II compiler is written in its own language, thus lending itself to modification.
    Extract: History
    History
    The basic ideas behind META II were described in a series of three papers by Schmidt, Metcalf, and Schorre. These papers were presented at the 1963 National A.C.M. Convention in Denver, and represented the activity of the Working Group on Syntax-Directed Compilers of the Los Angeles SIGPLAN. The methods used by that group are similar to those of Glennie and Conway, but differ in one important respect. Both of these researchers expressed syntax in the form of diagrams, which they subsequently coded for use on a computer. In the case of META II, the syntax is input to the cemputer in a notation resembling Backus normal fore. The method of syntax analysis discussed in this paper is entirely different frem the one used by Irons and Bastian. All of these methods can be traced back to the mathematical study of natural languages, as described by Chomsky.
    Extract: How the META II Compiler Was Written
    How the META II Compiler Was Written

    Now we come to the most interesting part of this project, and consider how the META II compiler was written in its own language. [...]

    The META II compiler, which is an interpretive program for the META II machine, takes the syntax equations given in figure 5 and produces an assembly language version of this same interpretive program. Of course, to get this started, I had to write the first compiler-writing compiler by hand. After the program was running it could produce the same program as written by hand. Someone always asks if the compiler really produced exactly the program I had written by hand and I have to say that it was "almost" the same program. I followed the syntax equations and tried to write Just what the compiler was going to produce. Unfortunately I forgot one of the redundant instructions, so the results were not quite the same. Of course, when the first machine-produced compiler compiled itself the second time3 it reproduced itself exactly.

    The compiler originally written by hand was for a language called METAI. This was used to implement the improved compiler for META II. Sometimes, when I wanted to change the metalanguage, I could not describe the new metalanguage directly in the current metalanguage. Then an  intermediate language was created -- one which could be described in the current language and in which the new language could be described . I thought that it might sometimes be necessary to modify the assembly language output, but it seems that it is always possible to avoid this with the intermediate language. [...]

    All subroutines in META II programs are recursive. When the program enters a subroutine a stack is pushed down by three cells. One cell is for the exit address and the other two are for labels which may be generated during the execution of the subroutine. There is a switch which may be set or reset by the instructions which refer to the input string, and this is the switch referred to by the conditional branch commands. The first thing in any META II machine program is the address of the first instruction. During the initialization for the interpreter, this address is placed into the instruction counter. Extract: Further Development of META Languages
    Further Development of META Languages
    As mentioned earlier, META II is not presented as a standard language, but as a point of departure frum which a user may develop his own META language. The term "META Language," with "META"
    in capital letters, is used to denote any compiler-writing language so developed.
    The language which Schmidt implemented on
    the PDP-1 was based on META I. He has now implemented an improved version of this language for a Beckman machine.
    Rutman has implemented LOGIK, a compiler for bit-time simulation, on the 7090. He uses a META language to compile Boolean expressions into
    efficient machine code. Schneider and Johnson have implemented META 3 on the IBM 7094, with the goal of producing an ALGOL compiler which generates efficient machine code. They are planning a META language which will be suitable for any block structured language. To this compiler-writing language they give the name META 4 (pronounced
    metaphor). Extract: META 4
    Schneider and Johnson have implemented META 3 on the IBM 7094, with the goal of producing an ALGOL compiler which generates efficient machine code. They are planning a META language which will be suitable for any block structured language. To this compiler-writing language they give the name META 4 (pronounced metaphor).
          in Proceedings of the 19th ACM national conference January 1964 view details
  • Brown, J. H. review of Schorre 1964 (VALGOL etc) view details Abstract: As indicated in the title, META II is a compiler writing language. It can best be described briefly in the author's own words in his introduction:
    "META II is a compiler writing language which consists of syntax equations resembling Backus normal form and into which instructions to output assembly language commands are inserted.... The method of writing compilers which is given in detail m the paper may be explained briefly as follows. Each syntax equation is translated into a recursive subroutine which tests the input string for a particular phrase structure, and deletes it if found.... For each source language, an interpreter is written and programs are compiled into that interpretive language."

    The author presents two compilers, VALGOL I and VALGOL II, written in META II language, which were compiled and tested. Also META II, itself, was written in its own language and compiled. The author forgot one redundant instruction in trying to produce what the compiler would produce, causing the difference.

    The article describes the three compiler languages in considerable detail; and from the way it is written, it sounds as though the author had an interesting and educational time in performing these experiments.


          in ACM Computing Reviews 6(01) January-February 1965 view details