📜 ⬆️ ⬇️

Donald Knut: about the assembler, the translator and competent programming

" Literate programming is a relation to computer programs as to literature: a computer program is written not so much for a computer, but for people so that people can read it. And as I write programs, I am, in a sense, a teacher. "

image


“Let's change the traditional priorities in creating programs: instead of presenting our task as creating instructions for“ What to do? ”For a computer, we will focus on explaining to other people the descriptions of our vision of what a computer should do under program control.”

Literate programming (66/97)



')
In the meantime, I also decided on the exact version of TeX and the very concept of literate programming. Let me go back a little bit to the story of the "tangle" and "disentangle" utilities (Weave and Tangle). In general, I think that the idea of ​​creating what is called “literate programming” was the greatest benefit from the occupation of the print business.

I like to learn. I do not just teach the computer, I teach the readers of my programs. I hope that one day they will award the Pulitzer Prize for the most competent program, etc.

image

I started this experiment because a friend of mine, Professor Hoare of Oxford, said: “Don, people don't even read computer programs.”

The publishing house of Oxford University was interested in the publication of some computer programs, as examples of how they should be written correctly.

And instead of some obscure files that people have to read, it would be a kind of literature, such as musical notation. People publish symphony scores, and not just listen to them. So why can't we publish computer programs? And his idea stuck in my head, but at the same time it scared me, because the real computer programs already created are full of compromises. A computer science professor could not allow this.

You can write a small program and compare it with small gems, but when it comes to a large program, we can, of course, pretend that it is a jewel, but that would not be so. And I don’t think that many program creators would be glad that other people read their work in the form in which it was available then. And I began to think about how to write a program so that people like to read it.

So, obviously, this idea of ​​literate programming appeared, I found a format in which I could present the program to other people, moreover, I, as the creator of this program, could understand it better. And so I got to this system, in which I could write a program in this programming language, then from this one program I created two more - one was converted from Pascal web services description language, and the other from WEB services description language into a document, which I could read thanks to layout, cross-references and understandable statements.

This system is very pleased me. I wrote programs in CWEB - this is the “descendant” of the original WEB system, and this gives me endless happiness to write programs in a form that I find most appropriate.

image
Donald E. Knuth: Literate Programming

Learning about Symbolic Optimum Assembly programs (23/97)




My family and I went to Lynwood summer camp for a week, which is located on the shores of Lake Erie. And we were there again a couple of years ago to refresh our memories. So, spent two weeks on the lake. I played tennis with my uncles and stuff like that, but I also took with me a few examples of computer programs I had heard about. And I had some free time that summer to familiarize myself with them. And, in fact, these programs have had a tremendous impact on my future life.

One of the programs was called assembler - it allowed writing programs using not machine language, but more symbolic. It simplified a lot ... I mean, when I started writing programs, I wrote everything in numbers, and if I had to add a number in section 1 to a number located in section 2, then I had to write something in 20.0.0.1. I had to write out all these numbers, drive them into the cards, and only then use them in my work - that's all I knew about programming at that time.

But that program was an innovation for that time, and it allowed writing programs by a simpler method. Instead of choosing the number for each section in the program, I could give it a name, and the device itself already determined what number corresponds to this name. But in those days, computers could not cope well with letters, they were designed to work with numbers, but capital letters could be used. With this assembler, you could use up to five letters per word.

( Note from safinaskar : "This assembler allowed the use of labels")

I remember exactly how I used it for my tic-tac-toe program, and I had to figure out which five-letter word would define a certain part of the program. And I remember with delight how I played tic-tac-toe, and how at the time of winning the program moved to the BINGO site. I used this word of five letters B, I, N, G, O for this part of the program.

Yes, I then learned about assembler and learned to encode. I used it in my work, but at the same time I wondered: “How does it work? What was going on inside, and how did the word BINGO correspond with the number? How did the machine immediately understand this? ”I had a listing for this program called SOAP 2 from Stan Poly from IBM. I myself also had a listing program called “IT-Internal Translator” - this is a new program that was created by 4 people at Carnegie, Carnegie Mellon University. This translator used an algebraic language, not a machine language. And this is long before Fortran or other high-level programming languages ​​appeared. I'm talking about the years 1956,1957.

And the point was that you could write X = A + B, well, actually it was impossible to write that way, because it was not possible to use the “+” symbol, so we wrote X1, Z, X2, S, X3, where S denotes “+”, and the letter Z was used instead of “=”, and each variable as X1, X2, X3 or something similar. But the topic is not less, you could enter an algebraic formula into the map, and then the device has already determined from this how to calculate A + B or what you need to do.

Instead of marking with numbers or symbols, there were algebraic symbols. And you could just transfer the program to a computer, and immediately the lights came on, and after a while you received the device with a computer programming language. Magic. I could not understand how it works at all, so I got a copy of the program they used to write this translator, and I got a copy of the SOAP program

The Internal Translator (24/97)




I brought it with me and spent the nights studying and trying to figure out how the program works. And yes, I managed ... First, I found out how the translator works, how exactly it translates the algebraic formula into instructions. But then everything was done terribly. There were mistakes in the program. Each time sharing something, the creators hardly managed to complete it.

I then turned to the SOPE program, the one from Stan Pauli - this program was accurate, incredible, as if you were listening to a symphony. Everything was connected so harmoniously, and this code was simple. I said then: "I would like to write programs like this guy does." And that second code from other developers, it was bulky and clumsy. "But I can write better than this."

Therefore, I and several of my friends wrote an improved version and called it RUNCIBLE, because each program had to have an acronym at that time, and it meant something like “Revised Unified New Basic Language Compiler”. ) or something like that. We had several reasons to call the program like that, but we wanted to remake that algebraic language, bring it into a more ordered form, and then we were able to improve the program a bit, and at the same time fit into the same 10kbyte.

That's how I spent my first summer at the Computer Center. And then, after the RUNCIBLE program was written, we also ... I also wrote the instruction manual for this program, and surprisingly, this instruction was used as a guide for students for the next year. And I found myself in a rather unusual position: in one of the classes they used the very same book that I wrote when I was a second year student.

And RUNCIBLE, we updated this program next summer, added a bunch of small things there, fitting them into 10kbytes. But we still had a floating point and other things that had to be worked on ... Therefore, we again decided to make an improved version. And so I wrote SOAP 3. You know, I liked the SOAP 2 program from IBM. I wrote SOAP 3, which was based on SOAP 2, and later we used it as an assembler to improve the software. And Kais allowed about a dozen students to write programs that would later be used by other students or faculties.

Fred Way, the director of this program, was very shrewd, he trusted the students and allowed us ... well, we had a great time talking to each other about all this. We also received the monthly magazine of the Association of Computing Machinery in 1958. Then we saw that people from all over the world published their ideas on how to write programs, and we then realized that we already know all these things and even more.

So my second post, after Potrzebie System for Mad Magazine, was an article about RUNCIBLE: turning formulas into machine code. I sent my article to the Journal of the Association for Computing Machinery, which was only just beginning to be printed. I was very naive then, did not understand how to publish in scientific journals. Yes, I saw magazines, knew that an article could be sent there, but had no idea about the meaning. The story itself was important to me, that's why I wrote.

I considered myself a speaker, a representative of these guys from Case Computer Center, with whom I worked together on the creation of RUNCIBLE. And I wrote an article about the methods that we used for RUNCIBLE, but nowhere in the article I mentioned the names of these guys, and I did not know that I would get the sum for these ideas, I just wanted to describe them.

Only later did I understand all this, learned about the conventions. And at that moment, I just wrote an article. And we prepared this material correctly, when the article was already published, as part of my collected works a few years ago.

Publication support - the company Edison , which develops an alert for traders , as well as makes a system of energy accounting and water supply for the cottage village .

Read more



List of 97 videos with stories of Donald Knut
Youtube playlist

1. Family history
2. Learning to read and school
3. My mother
4. My parents' finances
5. Interests in high school
6. Being a nerd of nerds at high school
7. My sense of humor
8. The Potrzebie System of Weights and Measures
9. Feeling the need to prove myself
11. University life: my basketball management system
12. University life: the fraternity system
13. Meeting my wife Jill
14. Bible study
15. Extra-curricular activities at Case
16. Taking graduate classes at Case
17. Physics, welding, astronomy and mathematics
18. My maths teacher at Case and a difficult problem
19. My computer experience
20. How I got interested in programming
21. Learning how to program on the IBM 650
22. Writing a tic-tac-toe program
23. Learning about Symbolic Optimum Assembly programs
24. The Internal Translator
25. Adding more features to RUNCIBLE
26. Want to go to Caltech
27. Writing a compiler for the Burroughs Corporation
28. Working for the Burroughs Corporation
29. Burroughs Corporation
30. My interest in context-free languages
31. Getting my PhD and the problem of symmetric block designs with ...
32. Finding a solution to the problem of projective planes
33. Inception of The Art of Computer Programming
34. 1967: a turbulent year
35. Work on attribute grammars and the Knuth-Bendix Algorithm
36. Being creative in the forest
37. A new field: analysis of algorithms
38. The Art of Computer Programming: underestimating the size of the ...
39. The Art of Computer Programming
40. Inspiration to write Surreal Numbers
41. Writing Surreal Numbers in a hotel room in Oslo
42. Finishing the Surreal Numbers
43. The emergence of computer science
44. I want to do computer science instead of arguing for it
45. A year doing National Service in Princeton
46. ​​Moving to Stanford and wondering whether to make the right choice
47. Designing the house in Stanford
48. Volume Three Of The Art Of Computer Programming
49. Working on the Volume.
50. Poor quality typesetting on the second edition of my book
51. Deciding to make my own typesetting program
52. Working on my typesetting program
53. Mathematical formula for letter shapes
54. Research into the history of typography
55. Working on my letters and problems with the S
56. Figuring out how to typesetting
57. Working on TeX
58. Why should the designer
59. Converting Volume Two to TeX
60. Writing a users manual for TeX
61. Giving the Gibbs lecture on my typography work
62. Developing Metafont and TeX
63. Why I chose and transcribed it to ...
64. Tuning up my fonts and getting funding for TeX
65. Problems with Volume Two
66. Literate programming
67. Re-writing TeX using the feedback I received
68. The importance of stability for TeX.
69. LaTeX and ConTeXt
70. A summary of the TeX project
71. A year in Boston
72. Writing a book about the Bible
73. The most beautiful 3:16 in the world
74. Chess master playing at Adobe Systems
75. At MIT
76. Back to work at Stanford
77. Taking up swimming help to help me cope with stress
78. My graduate students and my 64th birthday
79. My class on Concrete Mathematics
80. Writing a book on my Concrete Mathematics class
81. Updating Volumes of Computer Programming
82. The Art of Computer ...
83. Two final major research projects
84. lucky life
85. Coping with cancer
86. Honorary doctorates
87. The Importance of the Kyoto Prize
88. Pipe organisms of life
89. The pipe organ in my living room
90. Playing the organs
91. An international symposium on the Soviet Union
92. The Knuth-Morris-Pratt algorithm
93. My advice to young people
94. My children: John
95. My children: Jenny
96. Working on a series of books
97. Why I chose analysis

Source: https://habr.com/ru/post/314294/


All Articles