Session 1

Of the videos, this is the first session, on reading WEB programs.

Only about 10 minutes of the transcript on the right have been cleaned up. The rest are autogenerated from YouTube.

This will get replaced with the video (if the JavaScript runs properly).

Welcome

…special course in TeX82 that we plan to have intensively for the next three days. I’m going to give you all an OD on this particular system. This is something I'll probably do only once in my life, because I don’t know if I’ll understand the system as well as I do now at any other time in my life. And I think it’s an exciting time for the development of TeX because here’s when it’s beginning to move out and meet a lot of different kinds of computers around the world. It’s quite an experiment in portable software that we’re doing I think, a program of this kind and at this scale, to try to make it work on lots of different machines, and I’m pleased that so many people are participating in this experiment with us.

Handouts: TeX, WEB, TeXware

Now the lectures that I’m giving are on videotape as well as being you know in this live thing that we’re doing here, and the people watching on videotape will presumably be doing it after TeX is debugged because I hope to debug it next week — I mean to finish it next week. So at the time that the people are watching on tape, they’ll probably have a slightly different collection of handouts than you do in the audience right now. Now the three handouts that you were given this morning: one is the write-up TeX82 and this one, by the time people are watching the tape, I think will be published in a book. The first part of that book will contain the TeX user manual, which I haven’t finished writing yet; instead in the audience all you people have is a brief summary of what that language TeX82 is going to contain. Then the other two handouts you got this morning, one is this one called the WEB system of structured documentation and the other one is called TeXware. The web system is of course the one that we’re using to to make to make it possible to do system programming in Pascal and to make it portable and TeXware is a collection of four different auxiliary programs that you’ll find useful in installing TeX. The first program is is simply to print out the string pool file; we’ll talk about that later. Second program is to convert font metric files to a symbolic format. The third program goes back from the symbolic format to the packed binary format. And the last example is how to—is a symbolic printer of our DVI files the device independent output of TeX. Now by the time people are watching a video tape I think these two handouts I just mentioned are going to be Stanford reports and so if I refer to those that will mean a certain Stanford report. Finally at the end of your blue— at the end of your TeX82 listing there are some appendices and those will probably be published in TUGboat by the time anybody watches this tape. The appendices are related to a test program for the system and the idea will be that somebody can run this test program on the system and compare their answers to what I think the right answers are. So we’ll be talking about the test program later on too. Those are the sources for the thing.

These lectures / understanding TeX

Now as far as the organization goes, we have three days here and four hours each day. We’re going to meet 9:30 sharp — we’re going to start at 9:30 sharp every morning and 2 o’clock sharp every afternoon. And we run 9 30 to 10 30, take a break till 11, start at 11 sharp, eleven to twelve o’clock, and break till two o’clock, then we’ll go 2 to 3, and 3 30 to 4 30. That’s what I meant by overdose of this thing. In this time I expect that I’ll be able make you familiar with it—so that you’ll feel that you understand what all this document is doing, at least where to look for the other answers. Not that you’ll have proved it correct in your mind or anything like that, but I believe that it’s possible in about 40 hours of reading, not counting coffee breaks, to just go through and actually understand each module of the code, and convince yourself that it’s actually working. And of course hardly anybody is ever going to do that. You’ll just skim it and say well if I ever need to know about this module then I’ll look further and understand it. But if you had that as your goal—suppose that I was for example having a contest to see who can find the each remaining bug first, and I was giving out hundred dollars for every winner like that—if you had to do that, I think you would get to the end of it in 40 hours... if you were motivated. Well that’s a rough estimate as to how as to how much it might be to comprehend all of this code. Now the computer file that generated this book was about three quarters of a million bytes long and so that’s about how much chance there was for typographical errors in it. You know I mean each one of those bytes could have been could have been mis-punched and then there’s a chance for bugs too, and so on. It’s about as correct now as it would be if this was a book on mathematics which had theorems and proofs in it. Unfortunately computer programs also have to work [laughter] and so I — not quite there to that level yet. Now I know that people in the audience here have a large variety of backgrounds. Some people are—at least three of you I think have implemented the previous version of TeX and know every byte of that implementation, and and on the other hand there are people here who probably won’t be writing the the system code themselves but they want to use TeX heavily and they just want to get a good feeling for what’s inside of it. And so how can I make everybody happy in this way? Well I think probably that my best strategy is going to be to not go too fast, but to also... But those in the audience who are going to be users and not system people should try to imagine that they were system people—it won’t hurt—just to keep that in mind as if you were going to implement it. You don’t have to afterwards but it gives you the right frame of mind to understand the kind of question. Because what we’re going to do is, we’re going to consider as our goal to understand this complex piece of software and to see how the different parts fit together with each other and then… Even if you’re only going to be a user later on and not ever touch this code you’re going to have a pretty good feeling for how this complex piece of software is going to respond when you do certain—when you use it in in certain way

(Audio issues during the talk)

Now let’s see: can you hear me all right now? The mics are… No? Is it possible to turn the audio up better in the audience? 'Cause I gotta save my voice for the… Okay, is that any better? No? [Someone from audience says “It’s not working at all”.] There’s no mic—there’s no amplification at all? Oh here comes the man. Hi. Is there a way to turn on audio in the— okay. It’s this thing. Oh okay. Is this bett— aah, wow. Okay now you’re getting some audio? [Audience says “yes”.] Okay, well. Welcome to TeX82! [laughter] You heard it— At least if you laughed, you’ve probably heard that I said that once before, right? Okay.

Outline

Now the four lectures that we’re talking— the four things we have today are the fundamental ground level things on which we’re going to base things later. Don’t miss any of these. • The first hour is listed as “Reading WEB programs” and • the next hour “Representation of strings inside the program”. • The third it will be the “Data structures for boxes and glue” and • the last will be “Representation of control sequences”. And those are in other words the key things: first we’re going to find out how to read the program and then we’re going to find out how it represents things inside of itself. In order to get any further we have to see how the inside of TeX looks so that we can see how it deals with the things that we know appear on the outside. Tomorrow’s lectures are going to be about the main processing routines of TeX: • the syntax routines at the beginning, • then the semantic routines, and then in the afternoon I’m going to talk about • how TeX breaks paragraphs into lines, and • how it does hyphenation. On Friday we’re going to have four lectures that are primarily addressing the system dependent issues: the things that are most important to the people who are going to be installing TeX – in other words the things that are most critical to the portability question. And so • the first hour is talk about scanning of file names because we want to make TeX fit in with the local operating system and every operating system has different ways of referring to these names. And • then we’re going to talk about the font metric files and what they look like inside, so you can understand TFM files. • In the afternoon we’re going to talk about the DVI files and • the problems of initializing the production program: getting it going in the first place. So those are all things where we’re really bit-pushing pretty much on Friday namely the file names is a syntactical problem that’s different at different installations; TFM and DVI files are binary files that you have to understand because they’ll be on your systems; and then we have to also talk about what you do to bring— the bootstrapping process of bringing things into existence. Okay any questions so far?

The actual start of the talk?

Now I was delighted yesterday to get in the mail the new August edition of computer magazine, it has a cover called the evolution of Ethernet and I maybe I can flash that well now you won’t be able to see it I’ll just hold it up we might be able to get on the screen later but it’s got a beautiful picture of a web on it with droplets of water on the web and it’s just like you’d find in the Sierra Club calendar or something. What I’m talking about the first hour is the WEB system of documentation and and web is here thought of as something that’s not going to ensnare us but but something that has a structure network structure in fact they use the web to illustrate ethernet which is I probably doesn’t have that structure at all but but the web and net are somewhat linguistically related and they related also to TeX as we know now so I’d like to explain how to go about reading this this document the they said there were some appendices at the end that doesn’t count as part of the WEB description but WEB is the system that will take a that will take my web source files and and then I run tangle or weave on this on the source and I get either a Pascal program or a or TeX program. (The rest of this is not transcribed yet, just lightly cleaned up here and there.) If I run tangle now— I'll illustrate TANGLE in a minute if the computer is up… And if I run WEAVE on my web file, I get this book— TeX it and I get this book. Now let’s see: is the computer— computer seems to be up. So let’s try to switch over to the computer screen and I’ll illustrate what what tangle looks like when it’s running. One thing you have to do in order to use WEB is to have a TANGLE program working. So we have the lights down and see if you can see the computer screen. Now let’s see... a minor right file okay can you see at the bottom of the screen there I’ve said something with tangle it’s the contrast won’t be very very good but it’s asking me for all let’s see we should be able to get that up higher in the screen in a minute it’s asking me for the name of a web file and I will call for tango web that’s on my area web the cave it that’s when you for a change file. The change file is where you will put in your modifications that that you would want to use at your particular installation. I'll just use null for a change file. Now can anyone see that at all? OK? Now my output is output on tango PSC for example that’s what we use for suffix is there and it’s asked me for a pool file also and I don’t need a pool file in this case. Now pool file is where you it would put strings if there were strings strings in double quotes in the listing that have more than willing flung because tango will will do that not known as see if we can watch it operating here is printing out. As it gets to a starred module these are the ones that have come out in boldface type and in the table of contents in your web listing it prints out the number of that module as it gets to it so we can see what it’s doing. And it’s tangling itself right now because tangling from tangle.web web so this is converting the web description of the program into a pascal program and first of all it reads the whole thing into memory into a very compact form inside of itself and now it’s right in the output file every time I prints a dot it’s done 100 lines of output I’ll puff Pascal output ok so there 500 ok guys and so then when we get the output file that we should be able to run Pascal on that. Here it’s also giving us some statistics about—let’s see I can put that up higher on the screen—it told how large it’s it needed for its memory and it it stored that whole TANGLE program in approximately 18,000 tokens uh close our it tho those are over 18,000 bytes to represent the tango program in its contact form or plus the what is called byte memory and the TANGLE programs is in is in one of those handouts that you have. Now since we did that successfully let’s try the same thing on TeX I will try to handle TeX and here we just... TeX is a much larger program but I have to show you illustrated graphically so we do this so TeX.web and again I won’t use any change file and we’ll go to text a scowl and now are the pool file will put it in text tool and our text that pool at first and then in at our particular system extensions like pool can only really be three letters long so that’s going to be called POO. Alright so it’ll go run for a while but bit but it’ll be generating the it’ll be generating a Pascal source for this program. Now the WEB—the listing that you have of TeX begins with the table of contents. So very first as you open that covers you’ll see that there’s 55 parts to the program, and number one is the introduction and the last one is the index. And so these are the major sub-structures as far as TeX 82 is concerned. We’re going to be talking about for example string handling psyche part for that will be one of the things to talk about the next hour of the lecture. I want to to recommend that when you read this you start in section one and then go to number two and so on instead of starting at section 400 and something like this. Now there are some places to start that are worse than others and I think the section on alignment is the worst of all. If you try to start reading TeX by learning how it does \halign, I think that it might take well four hundred hours instead of 40 hours to understand what’s going on. Because alignment is done in something like posthypnotic suggestion by somebody who plants little ideas into the other parts of TeX and every once in a while they come into action and do the right thing. But it stands in the background most of time in it and it sort of lets everything else happen and automatically will rise to the right occasion at the proper time. That’s the kind of thing that I couldn’t write first and you shouldn’t read first. but especially I intended it to I actually presented this pretty much in the order that i wrote the program are almost been almost in that order because I I wrote the program in a way that I felt it called to be written. it’s saying that now before I go any further my mind won’t be at ease unless I do this I want to know how this is going to happen I got to do this now and that or somehow I don’t know exactly why I felt that way but I did usually feels rather strongly or what needs to be done next and I think also for reading it similar take similar questions would be in your mind that this is what you might want to know next just as to what to do. So it’s a combination of a bottom-up and a top-down approach where at first I go by them up and build up a lot of tools that I’m going to need later I know I’m going to need those tools but as I work on a particular tool I probably approach the building of that tool from a top-down direction. Now the thing is a total of twelve hundred and forty four modules at least at the present time and after i finished debugging it will probably be 1245 the and these modules they all are numbered, so you can see that usually we get several modules on a page, and as I turn over you can see different modules. each one has a nice big bold-faced number on it and up in the middle of the page here you’ll be able to see the part number and the module number so for so there will be a little section sign in between so like this is part 35 in module number 6 52 okay and this is the part that’s doing typesetting a math formula. This whole listing of course was generated by my computer automatically from the web file. Now at the end we have an index and the index shows every occurrence of every identifier in the program and then there’s underlined ones. The underlined ones indicate where that identifier was defined so let’s take this other things in the index besides identifiers and talk about those in a minute but let’s take this one empty so empty is defined here in module 5 88 so 588 is underlined it’s used in all of these modules here we are going to look them all up but let’s check us check out 588 and see what empty is is doing in 588 and it turns out that there’s a definition of empty here both in in text where explains that what empty means math type empty indicates a field with Nova or you can’t see the few things that people on the videotape can see and I’m I’m I’m sorry I’ve been assuming that you could you could read a little bit what I saw what I see on my monitor here okay I’m let’s can we turn the lights down and put the end and give them on this screen what what I see on the monitor is that possible can you can you see anything that we’re all in all I see you it’s it’s it’s incompatible because they need a light to get the to get the camera to read this okay well forget I’ll meanwhile by the way TeX is tangling up to module number 749 and we’re time sharing and getting fifteen percent of the machine in the Lotus 4.5 ok now the anyway are saying that if we look in the index you if you look in the index then that should refer you to where things are defined and and all the uses of them except if the if letter is only one if it’s only one letter long then the index only gives the underlined references to it it doesn’t give anything else so if you see in the index for example I probably have a letter F all by itself and so under F there will be lots of underlined entries for F well that’s wherever f was used what quest was declared probably as a parameter to a procedure or local variable in a procedure if there’s any fonts because the one letter identify as our intended or probably used so often and nobody would care to see them in the index now that other things that appear in the index are error messages so if you if you see an error message come out of TeX and you want to say well where in heck was that error message generated then this will tell you what module to find that and a few few things you’ll find it well reserved words you don’t often find in the index unless I specifically said I wanted to indicate that the word begin is used in this module in some interesting way but usually Pascal’s other words so of course won’t be indexed by the time the book is published we expect that there will be a lot more entries in the index that will that will keep key you into where TeX does various operations so if you want to see where it is TeX handle some something like lowering a box or something like that you might look under you might look up the index under lowering a box and it might be there I’m going to try to go through this and this as I do with other books and try to figure out what ought to go into the index of the book but I haven’t done that yet very much so the other kinds of index entries that are just in roman type there are only a few of them so far and those those will be like you know if there’s one in entry here for chinese characters and it says chinese characters are discussed in modules 128 457 500 and you can if you’re interested in extending text so that it would deal with chinese characters suggestions for doing that are in those are most modules now each module except the index has a same basic structure to it and it’s a three-part structure: there’s the first part is TeX, second part is definitions of macros, and the third part is pascal now the gnarls modules have this have all three parts they can be empty you might not have a TeX part might not have a definition part you might not have a Pascal part but if but you never have more than one TeX parking you never have a definitions after the Pascal park you never have a TeX part of you know it always has that order TeX definitions Pascal and they might be absent this is something that to turn out to be a fairly good fairly easy thing not only to implement but also to it was approximately where I was writing code when I when I tested this place out when I when I was sketching out the ideas of web last phone um now the TeX part then is expository it’s supposed to supposed to explain either a what the whole idea of what’s going on now and in the future or it will explain some less obvious point about about the code that follows perhaps telling you the environment of the code telling you what you what’s supposed to be true at this point I reminding how we got here things like that states I’m kind of an invariant of a loop that will be there explain why that Luke might be expected to terminate saying why it why I didn’t do such and such they comment at the beginning depend on what I think are what is it worth saying I try to think of something interesting to say in every module that has passed caltex that’s going to be contributed to the main program anyone the definition part defines macros or talk a little bit more about that in a minute that’s a key thing to understanding a program written in web and then of course then the Pascal part at the end is Pascal code I try to shoot for about 12 lines of code in in these as a maximum sometimes I go up a little more but I try to keep it to something that you can understand as a unit the idea being that if you if you have faithfully come into this module from from the previous ones you should be able to know enough about it about the current subproblem and what and what you’re supposed to do in this module to fully understand it in terms of the in terms of these 12 lines just advice by looking at these back maybe if you’re I would go back and forth over the 12 line a few times and when you say oh yes I got this this makes sense to me so the the modules are small enough that the that you can perceive this structure and perceive the whole idea they refer to other modules in different ways let me see take a sort of a random I just turned to module 1 180 which is on page 59 of your of your of your handout this is I just chosen at random and it said display the value of glue set of P and so that’s a little module that his country is actually I might tell you that it’s used when we’re trying to print out p is pointing to a box we’re trying to print out what the glue setting is this is the ratio of how much the glue has to expand and if the glue is going to be expanding by a nonzero amount we want to indicate that amount of expansion because we’re going to wear this is part of the diagnostic output to explain what wanted text data structures in national art form so the code then says if glue side uppy is not 0 then we will print comma glue set now in those cool quotes in the print statement print double quote comma comma glue set you are you see that this is at one of those strings that I mentioned before strings with double quotes Pascal use a single quotes for strings tango makes those strings and puts them into a string pool file in fact it has finished now and it said it wrote 897 strings to the string pool so there are there are eight hundred ninety seven different strings in the in the program if if if I use the same string several times it will of course do it only once now tango converts that to an integer and the integer that it uses starts at 128 because the 20 21 27 are we are reserved for the single character strings and there’s an internal code there’s a specific and it’s essentially ascii code that’s used so that if you had a double quote a on double quote that always refers to ascii code abate it doesn’t refer to your local and to dicker whatever code you might be using that always refers to ascii code of a will talk about characteristic problems later on when we talk about strength but that’s oh so anyway this is a number so when I says print double quote blue sec and double quote that’s really in the Pascal file is going to say Prince 428 or some some other integer will be in the Pascal program then we check and see if the glue sign of P is shrinking and we print a minus sign into indicated that the glue is shrinking instead of stretching c and then we have problems to see whether what we’re going to print out some value if it’s real large then we’re going to print out a greater than 20,000 or less than 20,000 somebody anyway that’s the way the program works here and it says that the bottom this code is used in section 1 78 so if you need to know where this module was applied it was over here in modules 178 178 indeed applied it here display the value of glue set P and in that module it that module is display box and so p is pointing to a box and we and we and we haven’t in this module the problem is how to display a box and that breaks down into subproblems and so let’s just read through that codes that you get the idea so you look at see what kind of a box it is it’s going to be either an H list Notre realest know we’ll talk about data structure to say afternoon but that means it’s in each box or vbox essentially so we either going to print the hov the H is going to be the ASCII code h because this is a 1 1 letter string you see print escape means it’s going to prefix it by a backslash it’s going to print a backslash in an age otherwise if it’s a V list notice printed back section of e otherwise there’s some Club unset node which is used in alignments and then we have a box and a left parenthesis and it will print the height of the box as a scale number we’ll talk about these things later and then it says Prince of dimensions the height the depth and width and then it would check if it’s an unset note it has to do something special display special fields of the unset node P&S module 179 which we don’t care about for the purpose for our purposes now we can say okay that’s going to be something that’s going to display those special fields otherwise we will display the value of blue set P that’s the one and out we looked at first and that also say whether it’s stretching or shrinking unset notes don’t have glue sets that’s why we do it differently and furthermore I don’t have shift amount this this is whether if the box will shift it up or down or something like that and so we check and see if it’s shifted so that finishes this module 178 it referred you see two modules 179 or 180 but if we had to actually stick the code in there it would be a distraction so we don’t want it so for now we concentrate on what what are you doing it display a box you have to go through that many operations and then you’ve done it now this code is using section 1 77 which indeed is called display node p and it breaks down it’s a case statement that has many sub cases the first three cases where ageless node V list no done said node said display box p that’s where we do this or we had to display a rule or insertion or all these things we have to possibly display and there’s another module here that fits in to the case statement called cases of show notice that arise in Emily’s Sony this is when you’re trying to display something in math about and it only occurs in math mode so we don’t even write it in this part of the TeX program since we only a person reading it doesn’t know about mass mojet in fact when I wrote this part of it I didn’t know about math knowledge it myself so i just made a module saying well i’m going to handle those cases later and in 596 that the arm will will have indicated what you will the exposition will have explained what what math mode is like and so there will be display instructions in there and that will be patched into the program by tango at this point so we’ll have a case statement that also includes other cases for things like square root signs and so on that have to be displayed and then it says other cases print unknown node type and this is something I'll talk about with respect to what you do in case statements in pascal if they it agree that really means all other cases that haven’t been listed here and this code was used in 176 and if we look at 176 it doesn’t tell us where it was used in 176 it just ends at the bomb says what doesn’t talk say where it was used if it doesn’t say where the code was used this means it’s it’s really on bottom level this is part of the whole Pascal program itself and so some the things in bottom level are strung together in the order that they appear here so this this module 176 will follow the previous code for bottom level in in the program any questions so far on this now that the macro definitions is something I’ve got to talk about next let’s take a simple case of macro there are three kinds of definitions and they all say define and the one is is numeric definition and and then there are there then there are definitions that substitute with or without parameters those are the three kinds of definitions let’s see if I can find a example okay numeric definition I’m on page 51 s module number 156 has lots of numeric definitions I’m laying out the memory and I’m giving symbolic names to specific parts in the memory so i defined zero glue oh this is not a numeric definition I’m sorry it has a it has three lines yeah it’s an equivalence instead of an equal sign how this means it’s a text substitution because I if it’s just an equal sign it means that it’s a numeric thing which I’ll compute at at tangling time but this is a text substitution because men base is a compile time constant that’s that that art it’s something anyway that that I didn’t think I I could necessarily know so I I’ve used three hours here and then i define Phil glue to mean zero glue + blue specks I’ve anyway those are these are things that have been defined elsewhere this is an example of a definition and whenever I say camp head later on or it’s going to mean hi ma’am base plus 3 and this means this will be a more mnemonic way to refer to tamp head it’s and the comments as it’s a head of a temporary list of some kind so each of these things is we try to explain it in words as as we define them on the previous page you’ll see a simple numeric definition define unset node as 13 so that’s the type for an unset node and that’s followed by the other two kinds of definition so we have all three of them in that module that’s nice the glue glue or shrink is to be substituted by shift amount which by the way is in macro itself so eventually will propagate down to two low level Pascal code blue stretch of its parameter is mem of that parameter plus six dot FC this allows us to to refer to Pascal structured types in a way that’s that’s a mnemonic indicating that we’re really looking at are the sixth this the you know the seventh word of a of something that stuck starts in locating a given location and we’re looking at it as a as a dot SC field of that word and that n if we were rewriting text for some other some other memory configuration we would only have to change this definition on glue stretch and to say how we actually are representing it in whatever language we’re really programming in because the rest of the program just talks about glue stretch of something and doesn’t know that it happens to be in words something plus six that so these these are the three kinds of macros the the constant macros are restricted that these numbers can’t get too large i think it’s something like 15 bits plus a sign so that the so that i shouldn’t be i shouldn’t define with an equal sign something to be I’ll never defile an equal sign something that’s a that’s a number are like 50,000 I can do 30,000 okay though the advantage of those small numbers is that I can do arithmetic on them and not put parentheses around the soap if you do text substitution you can have some troubles if you try to say- a macro and then that macro has been defined to be X plus y without parentheses but if X but if it’s the macro has been defined with equal signs and x and y are numbers so it will add those numbers together and it’ll work now now I don’t understand how I know when I look reading my program which of these identifiers is a macro and which isn’t somehow I’ve never been confused by it but press because I wrote the program and it’s something that is I in the back of my mind to experiment with it would there be a use for some type of graphic distinction between names that have been defined as a macro our names that are really there really Pascal identifiers on the low level everything eventually propagates into a Pascal code but who knows but but when I’m reading a program on you know I’m here in the middle of module number 700 something and it refers to glue stretch am I supposed to know that how do I know that’s not a procedure call oh it’s really it has thus it you know it looks like it might be a procedure call with a parameter it was really a macro call with the parameter well partly yeah I think it’s because I’m when I’m referring to boo stretch I’m I presumably know that it means that it’s a certain feel of a record and I’m always referring to feel the records by via macros so that I can have a symbolic way to refer to them that’s doesn’t that isn’t too closely tied to Pascal language itself but anyway some of the identifiers you see in the program are passed in the Pascal program others are our macros and fu as we if you refer to the index of course it tells you where it’s defined and you can always check exactly what it means act now I’ve written this so that in the final Pascal program no to identify as we’ll start with the same first seven letters so so on he has called rule says that they have to be distinct in their first eight but I I made it seven partly this helps me helps catch typographic errors because if two things agree to seven if I have a typographic air and and it tango will print out that there was that these two variables have conflicting names and it probably was that I that I made it a mistake in typing that after after the first seven letters but it also it’s just the because I’ve heard of compilers that that actually put this extra restriction on it the first seven should be unique but this also gives a clue as to whether a name is is a macro name or not because macro names don’t have to be distinct in therefore they can they can be a hundred letters long and and the first nine nine letters can agree because macro names are done by tangle not by Pascal and I implemented for a comparison of those names so whenever I have a long identifier which looks like it’s it has very high chance of conflicting with in its first seven let it with something else and that’s another dead giveaway that it’s a macro name because I would never dare use such a such an identifier and freeze those those valuable first seven letters for some other purpose like I don’t know we’ll see examples of that anxious okay now let’s take a look at the very beginning of the program and see how it gets how it gets started as I said the right way to read this is is starting at module one and going through I’m not going to be giving you homework exercises in these lectures but I would encourage you to to do some reading tonight and tomorrow night you’ll probably get more out of the lectures on Thursday and Friday the introduction here is primarily historic and and there is one definition at the bottom of the page that defines the banner string and here’s something that will be source of one of your system dependent changes presumably you will you will change this so that at the version number will also indicate that that this is the vax version or something else and then this right now its version minus one minus point two five because it’s not debug yet okay then I talked about the idea of system dependent codes and oh and other things that are in the index here in section 3 and and one of the things I mentioned here in section 3 is this idea of an index entry that’s called dirty paske there were a few places where I did things that aren’t considered kosher in pasco and if we look up dirty pesca on the index that will show you those modules and the modules will try to justify why they did the thing they did usually it was for debugging purposes where you had to fetch out a wreck not knowing what it was because something is going to gone wrong but anyway if your compiler is going to complain about those you want to you want to know about it part 4 is where we actually get going and and that end into the program and it’s and so here’s where we first start this is the first pascal text modules 123 didn’t have any pascal text there was this one definition and the very first thing well we have a definition here that i could explain em type i defined to be t ampersand Y ampersand p + % Eve and this is a special web thing that will will concatenate different identifiers together without spaces between them and I’m calling an m-type is t ype the reason is that i wanted very much to use type as one of the macros that i was going to define later but it’s a reserved word in pasco and so in order to do this I can define m-type for the one or two places where I needed to use pass cause reserved word and then ever then afterwards like I get to use type myself because this is a format which is a special kind of a definition that says that the m type identifiers should be treated like Pascal treats type and type should be treated like Pascal treats true so that will so for formatting purposes I can make those kind of definitions also that’s that’s a little thing for web now the program itself starts here with compiler directives in module nine then program statement and gives the name of TeX it doesn’t have any file names mentioned there because if it did on our past call anyway the user would have to type in filenames at that point and that’s not the way TeX82 does things. Then comes the labels and there’s a listing for labels in the outer block section 6 constants in the outer block types in the outer block this is where i use my m type and you notice now it gets formatted facing and then VAR this Global’s in the outer block then there’s a procedure declaration for the initialization and initialized procedure is going to be called to get things going and then there’s a module called basic printing procedures which we had to declare very early in the game and error handling procedures which we also have to declare early because any errors can occur almost anywhere you have to declare your error handling procedures soon but while you’re doing air is you have to print out what the area is so you needed the printing things even earlier and that incidentally you can force a discipline that when I’m printing anything out I got to do something that’s not going to that’s not gonna have a chance of air is going wrong so so when I write my print procedure I’m not supposed to overflow any buffers or anything that would cause an error message that would get that they might get into the loop okay now that’s the way the program starts and module five explains how it continues namely ollie magis from now on is going to we’re going to have more decorations of procedures and finally there’s going to a place called start here where we start and that’s going to be way at the end because we just a build-up procedure after procedure at the procedure doing the things that take is supposed to do and then I start here it’s going to say do it with something like that are going to call initialize and a few other things so and then it will also tell how to die gracefully at the end so these modules are further explained later on and I have special things declared in module 7 that’s for four different versions of the seven and eight which are four different versions of the same program this is all one program some of you have experience with the period the previous kinds of TeX and the end the and there were three programs there was TeX there was a system dependent module an ax and a pre processing module all three functions are combined in this one now and even a few more and these and in order to select out and things we we can change these definitions of these modules here i have debug and backwards debug and if i put code between debug and backwards debug it will be commented out normally because I’ve declared debug to be at sign left brace which is a real left grace to go into the program and backwards the guard to be a real right grace this by incidentally tango will will now change left braces to other symbols so that it won’t so still be a valid Pascal comment in between those two braces but these two break or if these were inside of other braces these wouldn’t you actually come out as races they come out of the brackets but this is this is now will will comment out all the code between debug and backwards debug similarly there’s statistics and backward statistics that comment out code that would slow TeX down but will keep information about how big it’s tables are getting and when you’re installing a system you want to find out how large how much of your memory is actually being used you’d like to see these statistics but it gets a repulsive for people printer model a time it slows assistant done I think well maybe four or five percent but maybe you wouldn’t want to pay that four or five percent if people aren’t using the statistics so that can also be commented out and it’s shown as commented out here then here is similarly is is is the other version of TeX in it and backwards in it these are things that are only present in the initialization version of TeX the one that you need to get started because it loads all of the hash tables with the primitives and loads preloads formats preloads macros so that it can put everything into a condensed file for efficient starting out of the production program so you have two versions of TeX production program a peck and the initialization called any time and to make any tech you you I you’ve got it because this is this is not commented out but to get the production version you have to put you have to change this to braces and you do this in your change file you never change the web file protect you just you just make a change file for any type a change file for production TeX and you run tango with one or the other now let’s see that ahead there will be other changes probably between these also because any technical 12 to allow yourself more room maybe for hyphenation tables since I you want to see how big those are going to be and and then afterwards when you have a production TeX you know that the hyphenation table is not going to be very big you can cut that that part time parameter down so those are the three things that can be compiled compiler directives is something rather most Pascal compilers if the comment starts with a dollar sign it will do something special like check-rein strangers or not and so and so on so I I’ve done that no I don’t know what time it is i I can’t see the clock in the back is can someone tell me what engaged it’s ten-thirty ok so i got only a few more minutes before we break we started five minutes late the so let’s take a look at the what the computer is done since we did start it out there and so you see that it came to a conclusion and in fact the where it says idle 25 minutes that means I haven’t done anything for 25 minutes but the two in front of it says that that was two seconds to minutes of CPU time so it took exactly two minutes of cpu time to do this tangling on on its deck 10 and it had a little more than 4,500 lines of Pascal code and the the numbers here the number of tokens here was was more like a hundred and ten thousand bytes in order to do the compressed thing in memory and also called tokens and then things that were called bites those are generally strings and and names of identifiers and there’s lots of those too so this is a this is a rather large order for tango fulfilled but it is in too bad now let’s take a look at the Pascal program that that was was generated so that’s c-tick esco now this should be forty five hundred and some lines long and taking a while to read in two for the etiquette to read it all in because that’s a page oriented during the larger the page is that on your takes now I just wanted to count how many semicolons are in this listing so we can get some idea as to how long is I’ve never done this before I wanted to find out how big tit how big TeX is so it starts out with with the program and you’ll see also that there’s things in braces there indicating what module that came from so if you can read the brace nine that that was two hours because this court was generated by the compiler directives which was module nine and module nine it it commented something out and then that bracket there was the comment with a break for the brace inside of a bracket so then we get a program TeX and it says label then the comment 6 says that those labels in the outer block are in module six you see how that works now let’s see if I if I search for a search for a semicolon now I’m going to search and see how many semicolons it confined just to see on any semicolons Ernest listing this is the way the Pascal program looks and its 4556 lines right now but it’s all uppercase letters except where we have a in strings if somebody’s Pascal doesn’t accept uppercase letters they would have to do system dependent changes on the strings in quotes you can see that text sources has a few lowercase letters they’re all the lines are 72 characters or less ok now it’s found 10,000 928 semicolons and so it’s approximately 11,000 statements and declarations in this program except that the word else also contributes so if i search for else I can find some more so let’s try else see if see how many occurrences of else there and program 664 so that has enough okay so so approximately not quite 12,000 statements and declarations are are in its program and okay I the corresponding figure for sale tech was 5,000 so I’m just trying to understand the difference now now say effect used declarations they would declare a lot of variables at the same time with commas in between them instead of having one line for declarations so that might account for is but the if you look at if you want to know about the size of this compared to pee Teck it’s a little shorter then then the p-tech bus assists debt so it’s a it’s approximately it’s actually gotten smaller than the than the existing version of text i believe the compilers will would be able to handle okay well if there are any quick questions i can handle them otherwise we’ll start I will break for half an hour and I can’t seek well yet there’s one or a format you give identifier equivalent to another identifier the first identifier is the is the one you want to be using the second one is the one that that that you wanted to format like so if you so ID so i formatted debug as begin I said format debug equal be equivalent to begin and that means that when texas debug it should enter a new level of indentation and put it in boldface like it does for begin and send backward see bug i made like n and and so why not what usually when i define I and identify a macro I’ll just I just want it to be treated in the normal garden vanilla the normal way that all identify the treaty but if I want some special treatment I can say treat it like a certain Pascal reserved word yeah the web manual is eight pages long so those rules are all given there in detail because at the very beginning we have as you know in most programs at the very beginning you there are features that are only used once for understanding TeX itself those little fine points of web programming aren’t going to be aren’t going to be important but if you want to know exactly what’s going on then then most those things to arise another yes okay the question is why use Pascal constants in some place in defined numbers in others and the answer is I made Pascal constants in the places where I felt the user could could change in that compile time and nothing else to go wrong and so this was the distinction is available I think of valuable distinction to have so the things that are constant in that Pascal program you should be able to change that number and recompile without doing anything to your web file or anything now but the to have the actual definitions it was possible for me to get around a lot of other of class cause restrictions for example Pascal doesn’t allow you two to have an array boundary that something minus one and by the lake by declaring it as a web macro i can subtract one from entangle will do the arithmetic and and it will not find in my program so that’s why i I’ve used web to get around these these problems with Pascal language it’s done correctly and Ada and I wouldn’t have had to do that neighbor I might have been a different a different here on some other time so a while all the format of a change file is that is that lines should match doesn’t see can we get that up on let’s take a look at TeX change we didn’t use a technical change there but them now this is a page oriented editor and so the first page is an index to the rest of the is there in phenix the rest of the file and they should ban so it shows you the first line of page to the first line of page three and so on his page to which which is the first change i made and then I just repeat verbatim align that’s in `tex.web` and then and then I made a ni made a correction so the first line matched then it goes on until the line it says at sine Z at the bottom there and and you see I I might change here was only to put an s in the version number it’s a version minus 0.25 s for Stanford I guess or sale or something a sale stands for Stanford artificial intelligence lab and and then these our index entries by the way here extensions to text I’ve this at sign up they’re always in is something goes in the index and I and at sign up arrow system dependencies changes for sale in medium caps pond I every time I put some in my change file i also put index entry saying this is this is a change that i made so that when i look at the index that i would we from this I could find all that all the modules that I’ve changed now the next module starts out with debug and backwards debug and in I copy it exactly except that I did change its poor for debugging also that the it isn’t braces it’s blank and so on so all of these changes you start out with a thing here I use a special switch on RD on our compiler a double you switch which makes it catch the kind of areas that IBM pesco catches that our compiler doesn’t ordinarily catch yes yes yes yeah that’s the idea that the change file is a small number of changes that will probably that that you can keep on fiddling with until you get it to work with your present to dot web file then when you get the real web file later on probably is that your change if I will still work with it I’m so lawless this independent chain with this I could extend to multiple change files but we hit the but since we’re listing all our files at the beginning of the tangled run right now we only have exactly one web file in one change file every time we run tanga ok so we saw this existing file is given on the tape that you get for TeX as an example of one changeup all that was done I’ve done I’ve made it here if you look at I example like the memory max has been changed to 1000 that’s not enough to do any user jobs protecting but it’s very good for debugging because when you’re debugging you want to you want the program to get into its complicated cases where it has to try hard be fun to find a free amendment how that first happened a few months later ok question over there okay yeah so so as soon as it finds a matching line like the 60 watt so tango reads this is this first line into a buffer the following parameters and so on keeps it in a buffer every time it reads in a line from the other file from the web file it compares those two buffers if they agree think it will will do something like not care about blank spaces at the end of something but if they agree exactly then it starts reading the change file and continues the change file until it comes to add sine Z at the beginning of the line it deletes all the stuff in the web prob till the beginning of the next module in this way you would be able to substitute more than one module for 48 you know your change ball could generate five modules for the four lonely the one in the other but we discourage this because then all your numbers will be off and you end why you know why do I do that so at the very end the just before the index there’s a module called system dependencies and this is and so so that’s where the system dependent changes this module should be replaced by changes to the program that are necessary in and here’s where you try to gather all of the all of the changes that are going to require new modules to be made that way all the this will be the only one that changes the numbering system and only index then we’ll really be Miss numbered nothing else will five will be go bother you there okay well we better break now and meet again at eleven o’clock sharp for the second session. Thanks very much.

That's the end of this page. If you have any feedback about anything on this site, you can contact me here. To go back to the top-level page (if you are not on it already), click here.