Dutch / Nederlands
Site map

I write, therefore I am

With this variation on a famous statement by the philosopher Descartes, I would like to express that writing about what happens in my life is important to me.

Sunday, April 26, 2015

Cursor language construct

In the past two weeks I have been working on the implementation of cursors for the Abstract Parse Trees as used in IParse. The AbstractParseTree class implements a kind of smart pointer with access to an abstract parse tree, where parts of the trees are shared as much as possible. You only have access to the top of the tree, so in case you want to modify something deep with in the tree you have to basically recreate it from that point. To avoid this, I introduced an AbstractParseTreeCursor class. I borrowed the cursor concept from relation databases where a cursor points to a record in a table. The cursor can be used to walk through a set of records and modify the current record. It is possible that a cursor becomes invalid when the row is removed by another process. Likewise, a AbstractParseTreeCursor can be come detached when the part it is point to has been removed from the value in the AbstractParseTree that it belongs to. It took me longer than expected to implement this. I also spend some time refactoring the code from a C to C++ style. The cursors to a value are forming a tree structure and at first I was using reference counting as well, which resulted in some complex code, until I found a more elegant way to solve the problem. The code still has not been fully tested and maybe some more refactoring is required, but I am quite happy with what I have achieve so far. I am still dreaming about a programming language that has the cursor concept build into it. Modifying parts of deeply nested structures seems rather imperative, but with the cursor concept it is possible to write more functional like programs. Functional language have some nice properties. So far, functional languages have not been used in distributed systems where multiple users can modify the same value, but I think that the cursor concepts extended with a revision concept could be the way to achieve this.


Thursday, April 23, 2015

Ulysses

At 11:30:12, I bougth the Dutch translation of Ulysses by James Joyce, ISBN:9789023414360, from bookshop Broekhuis second hand for € 9.95.


Thursday, April 16, 2015

Books

At 11:19, I bought the following five books from the charity shop Het Goed:
  • Jean-Paul Sartre: zijn biografie by Annie Cohen-Solal, ISBN:9789060128305, for €  1.95.
  • Vulpen by Heleen van Royen, ISBN:9789049951429, for €  1.50.
  • AKI Eindexamen '92 by Toon Seesing for €  0.80.
  • AKI-jaarboek 2005/06, ISBN:9073025087, for €  2.50.
  • aki akademie voor beeldende kunst 1998 by Bas Könning, ISBN:9075522126 for €  2.50.


Saturday, April 11, 2015

Job and Ecclesiastes

At 12:55:44, I bought the book Job / Prediker (Job / Ecclesiastes) written by Pius Drijver and Pé Hawinkels from bookshop Broekhuis for € 12.95. I bought this book in the first place, because I was impressed by the translation of Ecclesiastes when I read some parts of it. This has to do with the fact that Pé Hawinkels is a poet and a translator. He worked together with Pius Drijver, a catholic monk and theologian.

Water drops on magnolia flower

Today it rained and I took this picture of some water drops on one of the flower of our magnolia, who have only half opened. Today it has been a little colder than in the past days.


Thursday, April 9, 2015

Unparsing with matching

I have extended the unparse algorithm op IParse with deep matching in case there are multiple alternatives. This makes sure that every part of the abstract parse tree is unparsed (assuming that the 'same' grammar is used for parsing), but that it is possible that some parts will be unparsed differently from how they were parsed. These extensions are included in this ZIP file.

First flowers

When I arrived home today, I found that several flowers of our magnolia in the back garden. Not very suprising, because today the highest temperature was 6 degrees highter than in the past days.


Tuesday, April 7, 2015

IParse 1.7

In the past weeks, I have been working on a tool for processing Windows Resource files in combination with the translation tool OmegaT. This tool is able to read Windows Resource files and to translate them accoring to the translations that have been added with OmegaT, but there are also some limitations with respect to an environment where the input resource file is often changed. And then there is also the problem that the target resource file contains different dimension for the dialogs because some languages are more verbose than others and need more space for texts in the dialog. Typically, you only want an external translator for doing the translations and keep control over the resource files yourself. And you also want the external translator (often a native speaker abroad) to work on the translation while you still are developing your application, such that the translations are ready when you want to release your application. So, I decided to start working on a tool with which can use a source resource file and a Translation Memory eXchange (TMX) file to produce a new version of the target resource file. I decided to base this on IParse. For this I implemented a scanner for Windows Resource files and also added character encoding streams for supporting Windows code page 1252 (for West-Europe) and UTF-16. TMX is based on XML and uses UTF-8. I decided that IParse would store parsed data in UTF-8 format.

When I started thinking about writing some code for generating the resource file from an abstract parse tree, I got the idea to make this generic function of IParse. For this purpose, I also needed to extend the grammar of IParse to include so called white-space terminals. These are mostly ignored during parsing, but are used for formating during the unparsing process. After I had implemented this, I discovered a problem in the C grammar (in the file c.gr that I have been using) with respect to the C operators "&" (bitwise or) and "&&" (logic or). Because "&" has a higher priority, an expresion like "a && b" would be parsed like "a & &b". To prevent this, I introduced a white-space terminal that would return false whenever a "&" was the next character and I used this in the rule for "&" to prevent it from parsing the first half of "&&". (I am getting the feeling that there are still some more errors with parsing C with my C grammar due to the ambiguity of the grammar, where for example a function call, can also be read as a function declaration.) The unparse algorithm presumes that at each place where there is a choice, it is possible to decide which alternative to choose without having to inspect the 'children' of the parse tree. Warnings and errors are reported on the output if a grammar does not satisfy this condition. One should be able to resolve the errors with adding extra tree names (placed between square brackets) in the grammar, if needed. The command for converting a resource file from code page 1252 to UTF-18 would be:

IParse rc.gr -Resource -cp1252 in.rc -utf16 -unparse out.rc

The grammar for the Windows Resource files (in the file rc.gr) might not be complete as it is only based on a small sample of resource files. All relevant code is included in this ZIP file.


Thursday, April 2, 2015

Snow downpour

Around half past in the morning, we had a short snow downpour. I took some pictures, but they did not capture the amazing sight, probably due to the exposure time being to long. Several other colleagues were also watching outside. Some of the snow even stayed a little on the ground. Five minutes later the sun appeared again. Around twelve it repeated itself.


Tuesday, March 31, 2015

Diary Frida Vogels

At 9:47, I bought the book Frida Vogels. Dagboek 1970-1971 by Frida Vogels for € 14.95 from bookshop Broekhuis. Most of the time it takes me a long time to consider to buy a book, mostly ending up not buying the book, and at other times, it takes me a few seconds to decided. I have a weakness for diaries and (auto)biographic works.


Saturday, March 28, 2015

Filter language construct

New languages are invented all the time in the field of software engineering. Most of these languages are just a variation on existing languages reusing existing concepts in new combinations. Recently, I got the idea for introducing a filter concept that processes a stream of data into another form. (Can imagine that I am the first one to get this idea, but I do not know of a language that uses it.) I would like to use the UTF-8 decoding as an example, that takes a stream of bytes values and turn them into Unicode code points. In progamming languages, filters are implemented as pull or push algorithms. In the pull algorithm you implement some function or method that from a stream of bytes, retrieves the next Unicode character (code point), while in the push algorithm you implement a function or method that you feed bytes and that emits a Unicode (code point) to a file or appends it to the end of a string. The specification of a filter should be such that it is agnostic to the pull or push implementation and the language should have constructs where the use of the filter automatically implements the pull or push algorithm. Below the specification of the example filter in an extension of C++ that uses new keywords filter, consume, and emit.

filter UTF8ToUnicodeDecoder(byte, UnicodeChar)
{
    byte v = consume;
    if (value < 0x80) {
        emit UnicodeChar(v);
    }
    else
    {
        int _code_point;
        int _following;
        if ((value & 0xFC) == 0xF8) {
            _code_point = v & 0x07;
            _following = 4;
        }
        else if ((value & 0xF8) == 0xF0) {
            _code_point = v & 0x0F;
            _following = 3;
        }
        else if ((value & 0xF0) == 0xE0) {
            _code_point = v & 0x1F;
            _following = 2;
        }
        else if ((value & 0xE0) == 0xC0) {
            _code_point = v & 0x3F;
            _following = 1;
        }
        else {
            return; // error: not a valid start byte
        }
        for (; _following > 0; _following--)
        {
            v = consume;
            if ((v & 0xC0) != 0x80) {
                return; // error: not a valid following byte
            }
            _code_point = (codepoint << 6) | (v & 0x7F);
        }
        emit UnicodeChar(_code_point);
    }
};

I have not thought yet about syntax constructs for using the filter. The language should at least have an iterator concept (for the pull algorithm), a stream concept (for the push algorithm), and/or have pipe statements like in most Unix shells. In the above filter specification there are also a number of error conditions that can occur. Because there are many ways with dealing with errors, the error handling might depend on the context in which the filter is being used. Ideally, one would have some mechanism to specify the error handling at the place where the filter is used. I recently, implemented the push algorithm in a C++ class in the following manner, when working on new version of IParse:

class UTF8ToUnicodeConverterStream
    : public ConverterStream<char, UnicodeChar>
{
public:
    UTF8ToUnicodeConverterStream() : _following(0) {}
    virtual void emit(const char symbol)
    {
        unsigned char value = (unsigned char)symbol;
        if ((value & 0xC0) == 0x80) {
            if (_following == 0) {
                // error: out of place following char
                return;
            }
            _code_point = (_code_point << 6) | (value & 0x3F);
            if (--_following == 0)
                _out->emit(_code_point);
            return;
        }
        if (_following > 0) {
            // error: expecting more following chars
            _following = 0;
            return;
        }
        if ((value & 0x80) == 0x00) {
            _out->emit(value);
        }
        else if ((value & 0xE0) == 0xC0) {
            _code_point = value & 0x1F;
            _following = 1;
        }
        else if ((value & 0xF0) == 0xE0) {
            _code_point = value & 0x0F;
            _following = 2;
        }
        else if ((value & 0xF8) == 0xF0) {
            _code_point = value & 0x07;
            _following = 3;
        }
        else if ((value & 0xFC) == 0xF8) {
            _code_point = value & 0x03;
            _following = 4;
        }
        else {
            // error: incorrect start character
        }
    }
private:
    int _following;
    UnicodeChar _code_point;
};


Wednesday, March 25, 2015

Three leaves

Our magnolia plant now has three leaves and more are coming.


Thursday, March 26, 2015

Natural wells

This morning, I took pictures of the four places where water from natural is often flowing. Recently, a new place has appeared along the byclicle path. (See number 1 on the picture on the right.) They dug some whole beside the path that is now filled up with water. Three years ago they installed some drainage from about this spot till even a little further than the traffic lights for the bikes to cross the road (see number 2), but it seems that for some reason it is not working anymore. Near the traffic light and across the road there is often water flowing. A little further (number 4) there is a place where water is also welling up. This is one of the old places where the water was coming out of the ground. Two other places a little further along the road (that I reported about on April 7, 2009) seem to have dried up. In the past year some ground work has been performed in the area to replace the existing sewer drains.


Wednesday, March 25, 2015

Three leaves

Our magnolia plant now has three leaves and more are coming.


Thursday, March 19, 2015

Book from Het Goed

Yesterday, I discovered that the local charity shop Het Goed carries a rather large and reasonable good collection of secondhand books for rather good prices. This afternoon, at 15:35, I bought the book Steve Jobs: de biografie by Walter Isaacson for € 2.00 (including a € 0.50 tip).


Sunday, March 8, 2015

Leaves

This morning, the bud of the little magnolia plant has opened. I took a picture of it in the sun.


Thursday, February 27, 2015

The Bite in the Apple

I finished reading the book The Bite in the Apple by Christann Brennan, which I started reading on February 17. She was the first girlfriend of Steve Jobs and the mother of his first child, their daughter Lisa Brennan-Jobs. A very interesting book in which Brennan paints a fairly 'dark' image of Jobs. Yet it seems that she has not written the book from resentment, because she does it in a very honest way in which she discussed both the positive and the negative aspects of their relationship and also taking a step back to evaluate everything with her current understanding. In fact, she sets the Japanese Zen priest Kobun in a bad light and she describes him as one of the most influential persons with respect to the (lack of) character development of Jobs in his younger years.


Wednesday, February 25, 2015

Introduction

Diaries
April 2015
March 2015
February 2015
January 2015
December 2014
2015
2014
2013
Alzheimer's Disease
Trip to China 2010
-- contact --

Family

Frans
Li-Xia
Annabel
Andy
Honeymoon
Friends
Others
Pictures

Kabuki Syndroom

Collecting

Books
Maps
Bookshelves
Computers
Cameras
Trips
Flights
Weddings
Funerals
Reading
Movies
Useless lists

Hacking

My life as a hacker
Signature programs
Software enginering
The Art of Programming
HTML to LaTeX
JavaScript
eXtreme Programming

Puzzles

Hamilton cycles
cutting sticks
Califlower fractal
more...


Katla

Earthquakes
Graphs
Tremors
Helirecorders
Volcano Blog



Email

The email address below, may only be used for private communications. This email address may not be put on any mailing list. I do not want to receive emails with advertisements of any kind. My email address is:

Site statistics

If I did not count wrong, this site consists of 862 HTML-files with a total size of 18,323,007 characters, having 38971 internal links and 8015 external links. (About 679 of the external links are broken.) Furthermore, it contains 151 C/C++ program files with a total size of 3,412,360 characters, and 3 PASCAL program files with a total size of 35,259 characters. There are 54 text files with a total size of 349,419 characters. With respect to images, this site containts 1143 JPEG images (total size 49,267,961 bytes), 146 GIF images (total size 3,765,046 bytes), 81 PNG images (total size 2,028,051 bytes), and 2 BMP images (total size 3,727 bytes). With respect to sounds, it contains 14 WAV files with a total size of 389,002 bytes and 1 MP3 files with a total size of 70,182 bytes. It also contains 43 PostScript files (total size 308,387 bytes), 2 LaTeX files (total size 132,020 characters), 8 PDF files (total size 640,573 characters), 19 zip files (total size 1,853,850 bytes), 3 gzipped tar files (total size 52,345 bytes), 44 SGF files with a total size of 83,527 bytes, 89 KML files with a total size of 4,256,318 bytes, and 2 EXE files with a total size of 38,340 bytes. It also uses 16 JavaScript files with a total size of 901,077 bytes,

Copyright

Creative Commons License

I, Frans hold the copyrights of this and all other pages on this website. For this website a Creative Commons License is applicable. You may not use this work for commercial purposes. I consider all computer programs to be copyrighted by me under the GNU General Public License, unless stated explicitly otherwise. All quotes (text and program fragments) from other sources are excluded from this, and should be considered as copyrighted by their authors.

An alternative link for this website is: http://5z8.info/back-to-africa_b2t1i_super-nsfw.


























(This space is intentionially left empty)