Older blog entries for ajk (starting at number 19)

In the spirit of the recent article on project naming, I decided to rename TeWiS into Winters. Sounds much better that way.

schoen, you can find a list of recommended compiler technology books in the comp.compilers FAQ. The book is the dragon book, Compilers: Principles, Techniques, and Tools by Aho, Sethi and Ullman (Addison-Wesley, 1986). I've also found Wirth's books on the topic instructional (he has a book that, IIRC, builds a complete Pascal compiler as it goes, and I believe his Data Structures + Algorithms has a section on recursive descent). Stroustrup builds an expression calculator using recursive descent in his C++ bible (as do many other authors in various books using various languages).

schoen

It is pretty straightforward to write a recursive descent parser based on a BNF grammar by hand: make every nonterminal a procedure that parses that nonterminal, and have it recursively invoke other procedures whenever the BNF grammar refers to other nonterminals. Parse terminal symbols any way you see fit (a separate lexer that tokenizes the input is easy to write ad hoc or by using regular expressions). See any language/automata theory book or compiler technology book for more info.

In other news

I have taken over the TeXmalli document from liw. It is a sample LaTeX document written in Finnish.

I have been so involved in real life since Friday that I haven't had a chance to post any diaries. Most of that was because I was moving (new real-life contact information on my home page) and thus have acquired a permanent net connection, so I hope I am excused :-)

For the same reason, I have not been able to do any development work in the last few days.

Responses to Ankh

  • A transclusion - from what I remember from Ted Nelson's lecture series he held here some time ago - has the important (and good!) property that it refers always to the same version of the document, but if you went and checked the other end of the transclusion, you could see that that part of the text had been seriously modified (and you could see the diff between the transcluded version and the current version, too). And you can transclude only a part of the text, if you like. So, claiming that the XML entity reference is anything like transclusion is not really fair. But yeah, it does have some similarities (the ability to fetch from the network, for example, XML entities do that don't they).

  • It is important to realize that literate programming is not just a fancy method for commenting your code. The ability to rearrange the program text and thus for example ignore required nitty-gritty you are not interested to write just now (and put off its code to another section) is in some senses at least as important as the documentation-code dichotomy. For example, the design method of stepwise refinement becomes an actual possibility only after you start doing it the literate way: this allows you to incorporate the refinement steps of the design in the actual code that will be compiled and then executed. In other words, literate programming makes pseudocode executable.

  • I agree that the module problem is a real one with literate tools. Do you know Knuth's solution, as seen in for example Stanford GraphBase and the MMIX simulator? He composes the modules as separate literate works, which no doubt become chapters in the book. I don't personally find that style appealing, but it is a solution. I have personally decided to try out the include file mechanism: I split the program into include files which are then put together by CWEB as a single source for either CC or TeX.

  • GZigZag is not just "a simple data structure to avoid having to understand more complex one". Rather, it is a metastructure: you can define the usual lists, trees and whatnot inside the ZigZag structure quite easily. ZigZag the data structure gives you automatic memory management, persistent storage, distributed data structures et cetera, once it's fully implemented. GZigZag is actually a system in its own right: it has its own way of looking at data, everything is a cell (compare to everything is a file in Unix), and it provides you with means of data storage (persistent cells) and networking (distributed cells). I don't understand much of it yet - its way of looking at the world is sufficiently different from the conventional view that it needs adjusting to - but I can say (having seen demos of it and discussed it with Ted Nelson and Tuomas Lukka, the main architects) that it looks cool.

Today

Wrote more TeWiS and figured out some of litprog.

Question

Does anybody know a Plain TeX (not LaTeX or Texinfo) rendering of the GNU General Public License, version 2?

What is Zangelding?

It's been windy here today.

Ankh, I thought that transclusions were supposed to be bidirectional. Or am I mixing them with Ted's link concept? In any case, you can't do the full transclusion thing in XML, as the entity reference does not understand document versioning.

Anyway, if you like Ted Nelson's work, check out GZigZag, which is an implementation of his ZigZag structure. It really blows your mind out.

Ankh, I've read the literate programming column (it is reprinted in Knuth's Literate Programming book), and I believe that the part of MacIlroy's criticism that was based on the Unix pipeline was unfounded. He did not consider the context where the program was written: it was an exercise demonstrating a programming methodology, and it is common for such exercises to assume that certain solution types are forbidden (especially those that make the exercise trivial). And in any case, the original WEB system was Pascal only, so it was limited in what you could do with it (no Unix pipelines, for example); but this concern is no longer relevant, as there are language independent LP tools (like Noweb, which I mentioned yesterday), and you could actually write the pipeline in literate style - but since it's so short there is no point in doing that.

Literate programming is hard. I regard myself as an excellent writer of fact prose (fiction is harder by an order of magnitude) and as a decent programmer, but combining these two skills seems very difficult. Maybe it's the tools. I use Knuth's CWEB system to write TeWiS, and one of its problems is that it does not really encourage modular style (and I am a modular programmer!). Norman Ramsey's Noweb looks more interesting but its build-time dependencies are horrible (install Icon to install a program you need for compiling my C program... horror) and it still hasn't been ported to all Debian's architectures.

Apart from battling with CWEB and TeWiS my day has not contained any productive activity. I've been lazy, and reading up sfnet.keskustelu.ihmissuhteet (the Finnish newsgroup about human relationships), and rereading Childhood's End.

Bathroom has been usable since Friday, after I solved the "closed cold water valve" problem.

No work before Friday. University Easter is fun!

Hacked on TeWiS.

Played guitar, sang.

Processed Incoming.

While composing the previous version of this diary entry, I pressed M-q (known by Emacs fans as fill-paragraph) in Netscape, which killed Netscape and my diary entry with it. Why can't Netscape adhere to decades-old de facto standards?

My proposal to package Constitution of Finland in Debian resulted in a big thread about things we have discussed before. Of course, many of the names were new, people who cannot be expected to remember the previous discussion on the same topic. But this was not my intention, and I was saddened by the fact that very few of the postings even hit the point. Some of the messages were even making fun of it all in a way that hurt me somewhat. Well, I've decided (based on the little useful input I got) to refrain from packaging the constitution at least until we get the Data section.

CatDVI is now in Debian.

The Debian Incoming has now some 150 pending new packages. The number used to be over 170 a few days ago. It seems we have chances of getting the count down to a manageable level (30 to 50 would be a good number).

The bathroom is now fixed. We have a go for using it starting tomorrow. Yay. This all started on 15th of March, and the original schedule said it'd last for about 14 work days. Oh well.

Listening to Buddy Holly. His music is old but good. Since this is Easter time, I've also been listening to Verdi's Requiem, which is an older and a very good piece of music.

Got an idea for a novel I'm going to write someday.

Decided to rewrite TeWiS in CWEB.

This entry documents April 19, 2000. I'm not sure which date Advogate gives it, that depends on timezones.

I missed the exam. Damn. I wanteed to go there. Now I have to wait more than a month for the next attempt.

Taught. I'm also going to teach in the summer programming course. Things are looking good.

I thought I'd lose this phone net connection (unpaid bills) but it's still open, which is good. The death moment is 11 am each day; if it's open after that, it'll be open the whole day.

Bathroom will be usable on thursday evening.

This tuesday was not productive. I just read and slept.

Anyway, I seem to be a Hornblower fan. I should get some of the books in the original language.

Tomorrow is an exam (an easy course about OS basics). I hope I'll wake up early enough, although that means I'll get only about five hours of sleep tonight.

10 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!