The seamless interaction of software and hardware: the Lilith project and the Modula-2 programming language

“Wirth always wanted to create airplanes, and he needed the best tools. That's why he designed a lot of computer languages and microcomputers ... ”
Nicklaus Wirth is a world-famous scientist, engineer, researcher, Ph.D. in electrical engineering and computer science, professor at the ETH Federal Institute of Technology in Zurich, we know him as the creator of the programming languages Pascal, Oberon. In February 1934, on February 15, he was born in the town of Winterthur (Switzerland) in the family of a teacher. There was a large library in the parental home and little Wirth had been interested in books on the railway, turbines and telegraph since childhood. He was fascinated by technology, he was engaged in aircraft modeling and not just dreamed of flying, but lived this dream, the dream of conquering airspace. While still at school, Wirth “equipped” a secret laboratory in the school basement, where he was engaged in modeling.

Swiss Federal Institute of Technology in Zurich
When Virtu turned 18, he and two other Zurich aircraft models received from England such long-awaited radio equipment. Such a passion for modeling, later the development of remote control, can be said to determine the fate of the great mind. In 1954, Wirth entered the Faculty of Electronics of the Swiss Federal Institute of Technology in Zurich, received a bachelor's degree in electrical engineering. After that, Wirth studied at the University of Quebec at Université Laval, Canada, in 1960 received a master's degree. He was invited to the University of California at Berkeley (USA), where in the future he received a Ph.D. in electrical engineering and computer science, in 1963, under the guidance of Professor Harry Husky, he defended a dissertation on the development of Algol using Lisp.
Nicklaus Wirth was among those invited, he participated in the creation of the Algol-W language project, but IFIP rejected his project in favor of the Algol-68 language project. Until 1967, Wirth worked as an assistant professor at Stanford University, and in the same year he returned to his native Switzerland at the University of Zurich. He had the idea in his homeland to create something like Stanford. Becoming a professor of computer science, he not only “created and created,” but also engaged in organizational activities. The ETH campus has become very reminiscent of the famous Stanford.
Twice, from 1982 to 1984 and from 1988 to 1990, Wirth was the head of the ETH Faculty of Computer Science, in 1990 he became the head of the Institute of Computer Systems at ETH.
Virta was not satisfied with either the new Algol language or the languages already in use at that time, as he considered their properties and constructions often can not be explained logically. He did not consider the programming language precisely as a language, as a medium of communication between a person and a computer, but saw in the language primarily an abstract tool for constructing computer devices.
“In my understanding, a programming language is an incorrectly chosen term that misleads many. The term program notation would be much more appropriate. ”
This is how the road began to create the well-known Pascal. First, its first version was developed, then the first version of the compiler, and in 1971 a description of the new language. Its main feature was simplicity, it was built on "... clear principles of structural programming, formulated by Edsger Dijkstroy, on a beautiful mathematical base, laid down by Anthony Hoar, and on the brilliant architectural embodiment of the ideas of Algol-W, implemented by Nicklaus Wirth."
Technologically, he was interesting in that his compiler was the first implementation of high-level languages on himself. Two years later, a Pascal machine (P-machine) was developed with a special P-code (byte code). The interpretation method solved the problem of porting the Pascal compiler to different platforms. By the way, the concept of the P-machine was used by James Gosling in the construction of the Java language and architecture.
Wirth about Pascal and the P-code:
After it became known about the existence of Pascal, several people asked us to help in its implementation on various machines, emphasizing that they intend to use it for training and that speed is not of primary importance for them. After that, we decided to create a version of the compiler that would generate code for a machine of our own design. Later this code became known as the P-code ... Pascal-P turned out to be an exceptionally successful language for distribution to a large number of users. And if we had the wisdom to foresee the scale of such a development of events, then we would put more effort and thoroughness in the development and documentation of the P-code.
Pascal was perceived by many as a tool for teaching students programming. Based on the words of Wirth himself, to become a teaching "material" was not the main goal of the Pascal language, rather it was "... a reasonable compromise between what was desirable and what was effective." After all, you cannot successfully apply a language during training that is not suitable for solving any practical problems.
Let us come nevertheless to the key topic of this article about the turning point in the fate of Niklaus Wirth.
Virtu "... tired of programming languages, and the need to write good compilers for existing computers. There was a desire to create something new with our own hands, unknown."

Xerox alto
During his vacation at the Xerox Research Center in Palo Alto in 1977, Wirth took on a serious technical project - the creation of a structural programming language that was designed to build large and complex systems and its feature would be a design for expressing units separately from compiled ones system components known as modules. It was a one-year professorship leave, which was provided to “representatives of this profession” once every seven years, so there was plenty of time to prepare for the project. In the research center, a real personal station with a vertical monitor, a mouse and its own Xerox Alto disk appeared before his eyes. Such a ready-made implementation served as a catalyst for the implementation of the idea long ago carried in Wirth’s head to create his own computer, and even implementations on it of a language compiler, which is much more complicated than Pascal. To create an integrated computer system for the user and for the developer with a personal workstation for a specific language is what absorbed Wirth with renewed vigor.
Lilith Project and Modula-2 Language

It was necessary from scratch to build their own computer system, which would include hardware, microcode, compiler, operating system, various service programs. It was necessary to create a compact, universal language that could solve the problems of system and application programming. In 1977, computers were huge mainframes with time-sharing systems, and they were accessed via terminals and remote satellites. A powerful personal workstation was the revolutionary idea of the time. Wirth understood that it makes no sense to develop software that focuses on the old computing environment. The problem was that it was necessary to design and create a new computing environment, namely, a powerful personal workstation.
Nicklaus Wirth:
“I had a chance to get to know the Mesa language developed at PARC, which had such a design. I felt that an elegant descendant of Pascal could, with a new attempt, follow the spirit of his ancestor if it was created as an extremely economical language. His name Modula-2 testifies to the dominance of the concept of the module in our views, and this name was chosen - perhaps, unfortunately - not Pascal ++. "
Work on the creation and development of new hardware and new software was carried out simultaneously, Wirth and his group of like-minded people worked on creating a new programming language and its compiler, creating a basic OS, utilities, and the first applications.
Modula-2 language was supposed to be simple and universal, used for all Lilith software. Wirth used the means of distinguishing between the portable (applied) and non-portable (system) parts of the language, introduced the SYSTEM pseudo-module, which housed all the low-level programming tools (including type conversion functions).
It was necessary to clearly formulate the concept of a module and implement it as a means for separate compilation.
As Wirth wrote "... Modularity is a decisive property that allows you to combine conflicting requirements: ensuring the reliability of high-level abstraction by checking for redundancy and the availability of low-level tools that provide access to the individual design features of a particular computer. This allows the programmer to localize the use of low-level tools in several small parts of the system, thereby protecting against unforeseen complications. "
The concept of a module with explicit lists of imported and exported identifiers was taken from the Mesa language, the idea of a symbol file was borrowed as special information for the compiler about objects exported by the corresponding module. The OS for Lilith was the only hierarchy of modules that could expand or contract at the request of the developer.
Modularity, based on the principle of export / import of program elements and on support for separate compilation, has become the dominant feature of the new language. Means of support for multi-programming, unlike the Modula language in Modula-2, have been taken to the library level.
In 1979, based on the compiler for PDP-11, the first Modula compiler began to function. Initially, it consisted of 7 passes, each of which generated intermediate code and wrote it to a 2 MB disk, later the number of passes was reduced to 5. On the first pass, the lexical analyzer (scanner) generated a string of tokens and an identifier hash table, the second pass (it’s parser) performed parsing, the third pass solved the type checking problem, the fourth and fifth passes were code-generated.
The first experiments were conducted on the legendary PDP-11 (Digital) computer with 64 KB of memory.

multiple tower PDP-11 mainframes clustered
Nicklaus Wirth and Richard Oran worked on the first Lilith layout. Richard Oran, an electronics specialist, wanted to take an advanced software course and defend his dissertation; Wirth invited him to take up the Lilith project. Work on the project absorbed Oran so much that he even forgot about his dissertation, all his thoughts were carried away by the P-code and P-machine. It was necessary to design an architecture that would be most suitable for interpreting the M-code (compact code), the Modula equivalent of the corresponding Pascal P-code. The compactness of the code is a factor of paramount importance for the implementation of complex systems on small workstations. Compactness was achieved through the use of different address and operand lengths, 70% of all instruction parameters had values in the range from 0 to 15, the operand was packed in one byte with the operation code. For intermediate results, a stack was organized (implemented as 16-word fast SRAM-memory - a small set of fast bipolar registers). Due to the stack and flexible addressing scheme, the average length of instructions, including the operation code and data, was 10 bits. The M-code did not contain register numbers, since they were covered by the stack scheme.
For comparison:
“The code for the M-machine was three to four times less than the code for the PDP-11 and i8086, two to three times less than the code for the Motorola 68000, and one and a half to two times less than the code for the National Semiconductor 32000.”
Lilith was a computer with 4 Am2901 processor sets, executed on the board, was oriented to work with 16 bit words, the M-code was oriented to the byte stream. The memory size was 216 words (128 Kb). The layout was built from 4K * 1 bit chips. Access to memory in Lilith was provided through a 64-bit bus, to support vector graphics, fonts, copy functions of memory blocks, and to increase the accuracy of floating-point operations, the Lilith processor used additional firmware.

An innovation was the raster display with high resolution. Initially, it was a display measuring 768 * 592 pixels, later a vertical display measuring 704 * 928 pixels with a frequency of approximately 30 MHz. The drive used was a Honeywell-Bull D-120 with a capacity of 10 MB. A three-button mouse was developed (alas, I did not find a good visual example of this particular mouse).

so at that time the three-button computer mouse for Xerox Star looked like

an example of the Kolobok graphic manipulator from domestic PCs of the EU-1840 / EC-1841 type.
At the same time, Christian Jacobi implemented software support for the display and graphic windows. This became the basis of the first applications, such as a text editor with drop-down menus.
Modula-2, after its implementation, has become an effective language. At the end of the 80s, a trial series of Lilith personal workstations (20 pieces) was released in Utah.
Later in 1984, a new compiler was developed for Modula-2.
"... I felt that many parts of the compilation could be done easier and more efficiently, if it were then possible to use the currently available memory volumes (the ones we worked in are extremely modest by today's standards). Lilith's memory was 64 Kslov and its high the compactness of the code made it possible to implement a single-pass compiler.This implies a significant reduction in disk operations that consumed most of the compilation time. Indeed, the compiler’s compilation time was reduced from 4 minutes to only 45 seconds und. The new compiler, however, retained the breakdown into tasks, but instead of each task setting its own path - with sequential input and output to disk - a special module with the most common procedural interface was allocated in it. General data structures such as a table characters were defined in a separate data description module, which was imported by (almost) all other modules. Those modules were a scanner, a parser, a code generator, and a symbol file processor. When the development of a new compiler is completed, it is rarely possible to resist the temptation to make some changes to the language. So in this case, some refinements and changes were made, which were reflected in the revised description of the language. The only important change was related to the interface modules (or even more precisely, to the interface part of the module). This change postulated that all identifiers described in the front end are exported, making the export list unnecessary. " code generator and symbol file handler. When the development of a new compiler is completed, it is rarely possible to resist the temptation to make some changes to the language. So in this case, some refinements and changes were made, which were reflected in the revised description of the language. The only important change was related to the interface modules (or even more precisely, to the interface part of the module). This change postulated that all identifiers described in the front end are exported, making the export list unnecessary. " code generator and symbol file handler. When the development of a new compiler is completed, it is rarely possible to resist the temptation to make some changes to the language. So in this case, some refinements and changes were made, which were reflected in the revised description of the language. The only important change was related to the interface modules (or even more precisely, to the interface part of the module). This change postulated that all identifiers described in the front end are exported, making the export list unnecessary. " The only important change was related to the interface modules (or even more precisely, to the interface part of the module). This change postulated that all identifiers described in the front end are exported, making the export list unnecessary. " The only important change was related to the interface modules (or even more precisely, to the interface part of the module). This change postulated that all identifiers described in the front end are exported, making the export list unnecessary. "
The presence of a network connecting all workstations caused the need for servers (the first was a printer server connected to a Canon LBP-10 laser printer, the second was a file server). By the way, Lilith was the first computer in Europe to take full advantage of laser printing. In general, 60 computers have been released over the entire period. In 1990, they were discontinued.
“The Lilith project has proven that developing a monolingual system is not only possible, but also has several advantages. Literally everything, starting with device drivers and ending with a graphic editor and a text editor, is written in the same language. No different approach to the modules related to the operating system, and to the modules of the user program. In fact, this difference almost disappears, and together with it we get rid of the invariably bulky resident program block, which everyone is happy to do without, but everyone is forced to use it. ”
Wirth has always strived for harmony, the organic unity of the hardware and software components, and his perseverance, talent undoubtedly made an invaluable contribution to the development of computing sciences. It is believed that his Modula-2 language was a compact and effective alternative to the Ada language. Systems such as OS / 400 for IBM AS / 400 were also implemented on Modula-2, while Digital Corporation created the language Modula-3 based on the same Modula-2 as the basis for implementing its internal projects. Compilers were created for personal computers PC, Apple II, Lisa, Macintosh, SIRIUS / VICTOR 9000, SAGE II, Amiga, Atari ST, IBM RS / 6000 workstations, Hewlett-Packard (MOCKA), Sun SPARC (Edinburgh), IBM mainframes (WATCOM), SGI and VAX (MOCKA), Digital Alpha (ModulaWare).
Wirth created the Oberon and Oberon-2 languages (together with Professor H. Messenbock), the Oberon operating system.
As mentioned at the beginning of the article in 1984, Nicklaus Wirth was honored with the Alan Turing Prize, in 1989 with the Max Petitpierre Prize, and the Science and Technology Prize from IBM Europe.

Interestingly, many do not know that Java and C # are based on the ideas of Wirth. The best Wirth languages - Modula-2 and Oberon - are almost never used, although programs written in them still work.
The great scientist, engineer, and the brilliance of science always strove for simplicity, for which he called on everyone.
“Make it as simple as possible” is a favorite phrase of Nicklaus Wirth, reminds an old joke that a perfect computer should have only two commands: RPM and MAKEIT
RPM - Read Programmers Mind.
MAKEIT - Make It.


"The path Wirth has traveled in the search for an acceptable formalism of system programming, starting with NELIAC, through Algol-60 to the languages Euler and Algol-W, Pascal, Modula-2 and, ultimately, to Lilith, is full of impressive discoveries and amazing results."

Thanks to friendship and personal relations with our Soviet programming pioneer Andrei Petrovich Ershov (after his visit to the USA in 1965), Niklaus Wirth came to Akademgorodok several times in 1990, in 1996 and in 2005. This played a large role in popularizing the languages and systems of Wirth in our country. In the Pottosin group from the Institute of Insectiology, Siberian Branch of the Russian Academy of Sciences, an idea arose to repeat the Wirth experiment and implement a processor with architecture oriented to high-level languages (SOCRAT project).

The Modula-2 language was adopted by the USSR Council of Ministers as the base language for developing software for on-board systems. In 2005, Wirth again visited Akademgorodok and brought his Lilith computer as a gift, but could not present it, as the customs detained a “valuable cargo”.