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 the act of writing about what happens in my life is important to me.

Sunday, October 6, 2024

Seed pods in magnolia

This afternoon, after we went on a walk in the neighbourhood, I spend some time trimming some bushes in the front garden with a hedge trimmer. I also did some work on the magnolia and spotted some red seed pods as can be seen in the picture below.

I am thinking about when to harvest them. If I harvest them now, the seeds might not be mature enough. It looks like the fruits have not come out yet. If I wait too long, the seeds might be eaten by some birds and I will not be able to harvest the seeds. In 2013, it was on November 25 that we harvested the berries. I think, I am going to keep an eye on it for the coming week.


Saturday, October 5, 2024

Still life of the harvest

Below a still life of part of the harvest that I received this morning from Herenboeren Usseler Es or what I took from the giveaway table where other members can donate part of their harvest or where vegetables are harvested but not given out because they are too small or left over from a previous issue.

The picture shows:

State machines with a switch statement

While developing embedded software, you often have to deal with state machines, to implement non-blocking behaviour. If for example, one of the tasks for your embedded software is to read data from some UART and send it to another UART, you could have a function like:

void echo_infinite(UART *in, UART *out)
{
    while (1)
    {
        while (!data_available(in))
        {
            // wait
        }
        char ch;
        ch = read_byte(in);
        while (!ready_for_sending(out))
        {
            // wait
        }
        write_byte(out, ch);
    }
}

The above function will never terminate. That is no problem if that is the only thing your device has to do, but totally not acceptable, if your device has to do something else as well, for example, have a blinking LED. The traditional solution is to use a state machine and call the function implementing the state machine from the (never terminating) main loop. In case there is just one such task, one can make use of static define variables for the local variables. Otherwise, one has to define a struct for each such task and pass this as an argument. (See the page Machine independent implementation of Cooperative Multi-threading in C for how this could be done.) If you want to implement the above function echo_infinite as a state machine, you get something like::

void echo_state_machine(UART *in, UART *out)
{
    static char ch;
    static int state = 0;
    switch (state)
    {
        case 0:
            if (data_available(in))
            {
                ch = read_byte(in);
                state = 1;
            }
            break;
        case 1:
            if (ready_for_sending(out))
            {
                write_byte(out, ch);
                state = 0;
            }
            break;
    }
}

This code looks rather different from the above code. For this simple case, with only two states, it is probably not that difficult, but in case you have something like ten states, it can quickly turn into Spagetti code, that is difficult to follow, could have dupplicated code, and could have subtile bugs. In case the function implementing your task had no switch-statements and there is but one instance of your task, one could write the following code using some defines that are going to be explained below:

void echo_async(UART *in, UART *out)
{
    START_ASYNC
    while (1)
    {
        while (!data_available(in))
        {
            WAIT
        }
        static char ch;
        ch = read_byte(in);
        while (!ready_for_sending(out))
        {
            WAIT
        }
        write_byte(out, ch);
    }
    END_ASYNC
}

Notice that this code looks very much like the initial version. Note the use of static before the definition of the local variable ch. The defines one has to use, are the following:

#define START_ASYNC static int state = 0; switch (state) { case 0:
#define WAIT state = __LINE__; return; case __LINE__:
#define END_ASYNC }

These defines make use of the fact that the 'case' statements belonging to 'switch' statement may occur everywhere in the block following the 'switch'. In a sense, the 'switch' statement acts like a kind of 'goto' that can jump everywhere in the code belonging to it. It also makes use of the fact that the '__LINE__' macro returns the number of the current line. Note that they are replaced with the line number of the line where 'WAIT' is used, not where it is defined, according to the standard rules of how the C-preprocessor works. See the program D241005.c for an example that uses the above functions, where the functions echo_stm and echo_async are called a hunderd times, which is not always enough to print the string "Hello World!". The programs accepts a number as an argument to be used for initializing the random generator. (Find a number that makes all the functions print the whole text.) After the above two functions are called from main, the function echo_infinite is called, which never terminates, meaning that the program has to be terminated for it to end.

If one does want to use a 'switch'-statement in the code, one could use a combination of a switch statement at the start of the function and 'goto'-statements to labels matching the various places to wait. This does recuire one to number the states explicitly, which requires some additional work and bookkeeping, but it could help when implementing unit tests. When using C++, one can replace the static variables with private members of the class the method belongs to. This technique can be used to define iterators that are implemented as co-routines that yield results whenever needed. For a example, see the next method of the class InlineIncludesIterator in the program kaem_parser.cpp. For a more detailed description of all the possible ways to implement co-routines, see also: Coroutines in C.

Link


Thursday, October 3, 2024

Cutting pumpkins

Today I took pruning shears to work for the first time. After work at Herenboeren Usseler Es I helped cut and collect the pumpkins. The pruning shears were actually a bit oversized until we got to the 'family pumpkin', so called because of their size. This type of pumpkins were grown by Isabel Duinisveld from pumpkin seeds that she bought from the Marina Di Chioggia pumpkins in 2014. Isabel helped start Herenboeren Usseler Es last year.

ESP32-S3 I²C

In Chapter 27 of ESP32-S3 Technical Reference Manual describes the hardware components and registers that are used for the I²C bus. (On September 2, I wrote before about I²C.) For accessing the registers from C, the include file i2c_struct.h can be used. According to Table 4-3, one has to cast the address 0x6000F000 to i2c_dev_t* to access the 'I2C Controller 0' and the address 0x60029000 to access 'I2C Controller 1'. The include file i2c_ll.h gives all kind of helper functions to registers. Section 27.5 describes how the different command registers have to be used to send read and write I²C commands. It seems that the function i2c_ll_master_write_cmd_reg can be used to set the command. This function uses a value of the type i2c_ll_hw_cmd_t, which can be used to specify the various parts of the command. For examples how this function can be called, see the files i2c.c and i2c_master.c.

Link


Sunday, September 29, 2024

Hackfest: Day 2

At 11:00, I attended the lecture Building your own ISP _or_ How to become sovereign on the internet by Nick Bouwhuis (on YouTube in Dutch). At 12:00, I gave my lecture The live-bootstrap project. I spend some talking with various people including some of the makers at their booths, such as: At 15:00, I joined the lecture Live & work without Google, Meta, Apple or Microsoft? It can be done! by Björn Wijers. At 16:00, I listen to the lecture Verifiable Computing Project – Building Truly Open Source Hardware by Joyce Ng (Presentation).

On the way home, I bought some gerkins and sour herring for the curly kail hotchpotch Conny had prepared.

Links


Saturday, September 28, 2024

Hackfest: Day 1

Around 12, I arrived at Hackfest, which is held here in Enschede. I met several people, I had not seen before. At 13:00, I joined the lecture You Need a Hackerspace! by Mitch Altman (on YouTube). At 14:00, I joined the lecture Introductie MQTT, Tasmota & Node-RED by Ad (CrazyA) (on YouTube, in Dutch). At 15:00, I joined the lecture Dutch (home) computer history by Bart van den Akker from Home Computer Museum (on YouTube in Dutch) with some interesting facts about the Dutch history with respect to home computers. I learned that the Netherlands was the first to have an educational television series by Teleac in 1978 about the mircoprocessor given by Chriet Titulaer. The lecture also mentioned the Aesthedes a computer graphics or computer-aided design system that was introduced to the market in 1984. I talked with some old friends and missed the first part of the lecture Ravi the theatre robot by Edwin Dertien, a very interesting talk (on YouTube). Afterwards, I talked a bit with him. The last talk, I went to see was 28 kinds of uncertainty in science and technology, by Frau Heisenberg (on YouTube in Dutch). It was not very long, but quite funny. At 19:30, I followed with half a eye, the demoscene showcase by Okkie. Between 20:30 and 22:00, I also watched the live coding for fun with TIC-80. There were four people joining in this. Some had more experience than others. It looked like fun but I do not know if I would like to join in the next time. For the recording (with music) see: HackFest Byte Jam 2024.


Friday, September 27, 2024

Link


Thursday, September 26, 2024

World of Industry, Technology & Science

I visited the World of Industry, Technology & Science exhibition the Jaarbeurs in Utrecht. I spend a large part of my time there flashing firmware to the gadget of the World of Electronics, an environmental sensor with a solar cell that can be placed outside and is ready to send measurement data to openSenseMap. Visitors who had registered for the gadget had to visit a number of stands to collect the various parts and then have the firmware flashed. The gadget is build around a SMT32L072RZ and has the following sensors: temperature, humidity, a microphone (to measure sound levels), and a volatile organic compound gas sensort, with the posibility to add a SEN5x environmental sensor node for HVAC and air quality applications. I took a floor plan home.

After the exhibition, I walked into the center and visited the Steven Sterk bookshop, where at 17:48, I bought the book Brieven, dagboeken en een geheime liefde with letters, diary notes, and a novel by Laurie Langenbach with an introduction by Rutger Vahl, written in Dutch and published by Singel Uitgeverijen in 2017, ISBN:9789029511834, for € 12.50.

Link


Wednesday, September 25, 2024

Link


Sunday, September 22, 2024

Japanese newspaper

Some days ago, we received a bottle of Nin Jion Pei Pa Koa that we had ordered online. It came with a box with a Japanese paper. Today, I found the link https://www.chunichi.co.jp/chuspo printed on the front page, which is the 'last' for English readers. Japanese number the pages in the reverse order. On the first pages the text on the lines runs from top to bottom and the lines run from right-to-left. On the latter pages the text on the lines runs from left-to-right with lines going top-down. The link is to the website of the Japanese paper Chunichi Shimbun. It is the issue from April 2 this year. On page 16, I recognize a sudoku puzzle. It looks like there are also a Shogi and a Majong related puzzles.


Saturday, September 21, 2024

Link


Friday, September 20, 2024

Link


Thursday, September 19, 2024

Self-driving wheelchairs

Today, in the news, there was an item about self-driving wheelchairs on Amsterdam Airprot Schiphol. These are produced by WHILL Inc.. They have some repositories on GitHub. There is a repository about fiducual markers, which also has a reference to fiducuals on ROS.org. With fiducial markers placed on the ceiling, it is possible to determine the position of a wheelchair using a small camera. I also had to think about Dynamicaland where markers are used to determine the location of documents and/or cards on a table.


Wednesday, September 18, 2024

Tombstone diagram for live-bootstrap

In the past weeks, I have been working on generating tombstone diagrams (or T-diagrams) for Live-bootstrap based on the output produced by strace. I have published the results here on github. You can zoom and pan with the mouse. If you click on a process (T-shaped) or a file, it will show additional information. If you click on a link in the additional information, the process or file will be centered in the diagram and highlighted with a yellow back-ground.


Sunday, September 15, 2024

GOGBOT: Day 4

This afternoon, I did my last volunteer shift for this year of the GOGBOT festival. I took the role of a guard/guide at Grote Kerk (the Large Church) again, but now it was during the day instead of during the evening as on the first day. I think a different type of public came to visit the church. More elderly people and familis with young children. Going from the bright outside into a dark church caused many to not enter the mail hall of the church afraid to tripping. I told people that there were no thresholds and/or that the floor was flat. Some people, primarily young children, found the lights of the Depth Array work scarry. However, I did notice a wide range in reactions.


Saturday, September 14, 2024

GOGBOT: Day 3

I again did a volunteer shift at GOGBOT handing out program flyers near the entrences. At 16:07, I bought the book P.L.A.N.E.T.A.R.T. The History of Kees de Groot and PLANETART 1978 - 2004 written by Lars van der Miesen in English and published by PLANETART Publishers in 2024, ISBN:97890903888144, from underbelly for € 20.00. It is the catalogue with the exhibition PLANETART ARCHIVES X Kees de Groot 1978-2003 and the online PLANETART Archive.


Friday, September 13, 2024

GOGBOT: Day 2

This afternoon, I did my second volunteer shift at the information desk. There were not many people. I did watch Kees de Groot finish his art work. After the shift, I went to Rijksmuseum Twenthe where I (rather quickly) walked through the exhibition Gogbot x RMT (also called: The Tec Divide, where I saw the following art works: I also walked through the exhibition PLANETART ARCHIVES X Kees de Groot 1978-2003. I am probably going to revisit these exhibitions at a later time. I went back to the city center where I saw the following art works, which are part of GOGBOT: After having dinner at home, I went back in the evening and watched:


Thursday, September 12, 2024

Books

At 13:50:19, I bought the following three books from charity shop Het Goed:

GOGBOT: Day 1

This year I am volunteering again for the GOGBOT festival. In the evening, I took the role of a guard/guide at Grote Kerk (the Large Church) where in the main hall there were two large artworks: In the tower of the church there the artwork Dépaysement by Isabel Waller.


Friday, September 6, 2024

Amsterdam

On the way to Amsterdam, I first visted Utrecht where I went to bookshop Steven Sterk and Aleph books. In Amsterdam, I took the Metro line M52 to Rokin and walked to bookshop Scheltema. The section with ramsj books has moved to a different location on the top floor and has been reorganized, which felt like an improvement. I few floors lower, I found the book Strange Code: Esoteric Languages That Make Programming Fun Again by Ronald T. Kneusel and when I paged through the Chapter 10, which about Brainfuck, I found my name printed on page 293 with a link to my pages about it. Next, I paid a short visited to bookshop De Slegte, walked over the open air bookmarket on Het Spui, and visited the American Book Center. From there I walked to Galerie Ron Mandos to see the exhibition Best of Graduates 2024. I found the works of the following graduates noteworthy in the order I saw them:

Next, I walked to gallery andriesse & eyck to see the exhibition Colour Changes in Two and Three Dimensions 1979-2014 with works by Peter Struycken. Besides Peter Struycken, I talked with several people who I already knew. I also met with the artist Wilfried Lansink.


Thursday, September 5, 2024

Chestnut and musterd seeds

At 12:19, Conny gave my a large chestnut she just found on the street. This evening, I went to Herenboeren Usserler Es to help, with about twenty other members, to harvest the musterd seeds. We had to strip the pods with the seeds from the leaves and break open the pods. We used some sieves to seperate the seeds from the pods and bits of branches. The result needed more processing. We guessed that we had harvest about 4 kilo of musterd seeds. We were also allowed to get ourselves some buckwheat plants. They did not contain much seeds and might need some more time before they are to be harvest.


Wednesday, September 4, 2024

Hokuyo URG-04LX-UGO01 lidar

I am trying to get some data from a URG-04LX-UG01, which is a URG-04LX Scanning Laser Range Finder (Speccification that has a mirco-USB port. The scan area is a 240° semicircle with a maximum radius of 4 meter. The pitch angle is 0.36° and the sensor outputs the distance measured at 683 different angles. The laser beam diameter is less than 1 cm at 1 meter distance. I read that the angular resolution is configurable by the host. URG Series: Communication Protocol Specification.

After the usual trouble, I managed to build the hokuyoaist_example program from the gbiggs/HokuyoAIST github repository. For this you first need to install Doxygen, Sphinx, the Sphinx Breathe plugin and Flexiport: Flexible communication library. Note that the later needs to be installed (with make install) before running cmake for HokuyoAIST. When I run the program, without any arguments, it does return a lot of messages, including error messages, but I do not see anything that looks like data. On linux you can also just simply connect to it with minicom using the following command:

minicom -D /dev/ttyACM0 -b 19200
You can use the keystroke sequence 'Ctrl-A z u' to add a carriage return after each life-feed as the sensor will only return line-feed characters. Now you can enter command such as 'VV', 'PP', 'II' and 'GD0100020002' (followed by an enter) to retrieve information or data from the device. I looked into the code and I discovered a bug in the method hokuyoaist::ScanData::as_string where an unsigned integer was initialized with -1. When I changed that to 0, the program does show data. If you are given it clustring value (with the '-c' command line option) the range should be a multiple of this, otherwise an error is reported.

Tombstone diagram experiment

Today, I have been experimenting with visualizing Live-bootstrap using tombstone diagrams (or T-diagrams) where each T-shaped diagram represents on process that is executed. Below the result of this experiment, which only rather incomplete and not well aligned. It is incomplete because it only gives the initial thirdteen processes. Also I still have to add connect lines. I am thinking about calculate all the coordinates based on the positions of the elements based on the widths of the texts. I also have to think about how to list the input files. Some of processes have multiple input files, which can be a mixture of files produced by other steps and given input files. Some input files are used as input for multiple processes. The grey boxes are used to visualize the execution of processes by other process. Dragging and zooming with the mouse can be used to view the whole diagram.

This text is displayed if your browser does not support HTML5 Canvas.


Tuesday, September 3, 2024

Link

Monday, September 2, 2024

I²C for BadgerOS (Part 3)

From studying all the files, yesterday and the day before, I am still puzzled with some things. I went back to the Hackerhotel 2024 CH32V003 firmware repository and noticed that the function I2C1_EV_IRQHandler in the i2c_slave.h is nowhere called in the code. I presume that it is called from 'hidden' part of the firmware that is provided as a binary. I wanted to know if multiple I2C_STAR1_ values can be set. The code suggest that it might be the case, using multiple parallel if-statements and the bitwise-and operator. When I googled for I2C1_EV_IRQHandler, I found that it is also used in code to program microcontrollers from STMicroelectronics. There the use of chained if-else-statements seems to suggest to always at most one flag is set. (This is not particular good code design, to use bit-flags for excluding values. Maybe designed with the idea of that in the future they might occur at the same time.) So, if I understand it correctly there are two types of interactions on the I²C bus: On the I²C bus both operations start with a byte specifying the identifier of the slave peripheral and a bit-flag specifying whether it is a write or a read operation. (This is for the 7-bit address mode. For the 10-bit address mode, two bytes are used.)

The code of the function i2c_master_cmd_begin_static is not so easy to understand. One reason that is that it not only called from the function i2c_master_cmd_begin but also from the function i2c_isr_handler_default, which is the interupt handler that is called when reading, when the command is longer than the size of the FIFO hardware buffers, and/or when other events occur. The function starts with some code for dealing with a read command. The low-level function i2c_ll_read_rxfifo is used to read information from the FIFO read buffer that is filled during receiving the data over the I²C bus. For the ESP32C6 this is done by reading from a certain memory location that maps on a hardware register and which, I presume, also removes the value from the buffer. In the while-loop, the commands are processed, calling the function i2c_ll_write_cmd_reg to tell the hardware about the function to perform.

Is there anything to improve on this implementation? I wonder if instead of using a linked list for storing information about the command, where the elements are allocated one-by-one, it would be possible to use an array that is allocated on the stack or as a global variable. It states that the function i2c_master_cmd_begin only return after all the commands have been sent out (or when the specified time-out period is reached). I also guess, that when this needs to be implemented in BadgerOS, that some of the primitives, such as the locking and the event queues, that are used, need to be replaced by equivalent primitives in the kernel of BadgerOS. As the I²C bus is usually used to read out input and output devices on the badge, that the code to access those devices will need to be implemented as a service running within the kernel and that the process (that has the 'focus') will have access to those through a system call implemented by the kernel. When that is the case, the code cannot be 'blocking' in anyway and probably has to run in parallel with other code that communicates with peripheral, such as for example, WIFI. I do not have a clear picture how that should be implemented.

29.5° Celsius

The temperature at Twenthe Airport has gone up to 29.5° Celsius, which breaks the previous record of 29.2° on this date in 1991.

Link


Sunday, September 1, 2024

I²C for BadgerOS (Part 2)

Yesterday, I wrote the first part of I²C for BadgerOS. Today, I continue a bit further in understanding how it works. The functions called in the file managed_i2c.c are found in the file i2c.c of the Espressif IoT Development Framework. The functions i2c_write_reg and i2c_read_req, each build a list of 'commands' which are then executed by calling the function i2c_master_cmd_begin. This function also calls the function i2c_master_cmd_begin_static for sending the commands to the hardware calling various i2c_ll_ functions, which are platform specific. For the ESP32-C6 these are found in the file hal/esp32c6/include/hal/i2c_ll.h. The letters hal stands for hardware abstraction layer. I guess that the letters ll stand for low-level.


Saturday, August 31, 2024

Tiny chestnut

This afternoon, while walking around the neighbourhood, Conny gave me a tiny chestnut she had found on the road.

I²C for BadgerOS

I²C is a serial communication bus that is often used for allowing microcontrollers to communicated one or more peripherals. The bus makes use of two active wires and a ground wire. One active wire is used for data communication and the other for a clock signal. Usually the microcontroller acts as a master, generating the clock signal, and the peripherals acts as slaves. BadgerOS is an operating system being developed by Badge.Team for the various badge that are developed for various hacker camps and conferences, such as WHY2025 that will be held next year August. I have recently joined the Badge.Team and am going to look into the support for I²C in BadgerOS.

The Hackerhotel 2024 badge uses I²C in the communication between the ESP32-C6 microcontroller and the CH32V003 peripheral that is used to read out the five switches and control the LEDs. The code for the firmware can be found in the Hackerhotel 2024 CH32V003 firmware repository. I have studied the code in this repository. Some details about the protocol that is being used for the communication (over the I²C bus) for communication with the microcontroller is found in the function I2C1_EV_IRQHandler in the i2c_slave.h file. The firmware for the microcontroller, an ESP32-C6, of the Hackerhotel 2024 badge can be found in the repository hackerhotel-2024-firmware-esp32c6 repository. In the function coprocessor_intr_task a call of the function i2c_read_req is used to retrieve the states of the five buttons. The first arguments specifies the number of the bus (needed in case the microcontroller has multiple I²C communication busses). The second argument specifies the unique identification of the slave peripheral, which is hexadecimal 42, refering to The Answer to the Ultimate Question of Life, the Universe, and Everything is 42. The third argument is the register number that should be read. The fourth argument is a pointer to the byte array where the data should be stored and the last arguments is the size of that are and the number of registers that should be read. The function is defined in the file managed_i2c.c, which contains some more i2c_read and i2c_write functions. Only one of the write functions, the function i2c_write_reg is called in the code. One such place is the in the function bsp_set_leds in the file bsp.c. The functions in the file managed_i2c.c are implemented with Espressif library for I²C.


Friday, August 30, 2024

Nedko Solakov: Leftovers

Since last Tuesday, I have been reading in the exhibition catalogue Nedko Solakov: LEFTOVERS that I bought May 1, which is about a collection of unsold pieces from the private galleries Nedko Solakov work with. I initially bought the book because it has lots of numbers and letters on the cover. Now I understand that these are just consecutive ranges of numbers with some letter attachted, where the letters refer to earlier exhibitions from which the works were leftover, e.g., not sold. I read most of the introductions to the various exhibitions. Some pages contain reproductions of pencil written remarks by Solakov. This is a bit similar to how at one exhibition at Módulo Centro Difusor de Arte he made drawings and writings on the walls of the exhibition rooms got more attention that the works at display. Several collectors bought piece of plaster with those drawings and writings.


Wednesday, August 28, 2024

Drents Museum

Conny and I went to Drents Museum. We first visited the exhibitions Dacia - Empire of gold and silver, which shows more than fifthy gold and silver treasures and many more small rings and coins from Dacia from the stone age (3rd century AD) till about the roman conquest in 106 AD. After this we visited the exhibition: Figures of speech with the following sculptures:

Next we saw the exhibition Christine and Janus van Zeegen: Innovators in thread and paint. I found the following works noteworhty:

In the enterance hall, where there is also bookshop, there was a memorial of Matthijs Röling who died on July 10 with four of his works:


Monday, August 26, 2024

Programming language design

In the past week, I continued working on the stack based language as part of the attempt to replace the MES-compiler of live-bootstrap. I have worked on translating the C preprocessor (written in C++) to a program in the stack language. I made some improvements to the stack language to make the programs look more similar to the program in C++. I discovered that bugs are easily introduced when doing the manual translation and that debugging those bugs is not easy. I use objdump to disassemble the code, compare this with the file produced by the compiler for the stack-based language to match this to the program. I have thought about a program to optimize this process, but so far did not do any work on that. I did think about the language design. For example, in most language when a variable is used in an expression, it is interpretted as taking the contents of that variable and not the memory address of where the variable is located in memory. The C programming language has an operator, a single ampersant ('&'), to indicate that the address of a variable should be used. In the stack language, it is the opposite, you have to explicitly use an operator, the question mark, to retrieve the contents of the variable, instead of using the address. Note that in a language like C when a variable is mentioned as a target for an assignment (on the right-hand side) the address of that variable is to be used as the target for the assignment, not its contents. So, if in the stack language, I would want to avoid the very frequent use of the retrieve operator, the compiler would have to perform some analyses about what comes next. And I would like to keep the compiler as simple as possible. This having to make every operation explicit also makes you even more realize what is going on under the hood. Another thing that I have been thinking about is the constants that are defined for accessing fields/members of a record ('struct' in C). These constants are specific for a certain struct type, but because the constants are global, this means that a prefix is needed in case several records have the same field names, which could be placed at a different offset from the start of the record. The stack language now has, because it is rather simple, certain limits that make it impossible to define 'local' constants for this. I did think about some ways to improve on this, without making the implementation a lot more complex. I have not made any changes with respect to this. While tranalating the C++ program to the stack language, I realized that I could try to automate it and realized that the stack language would be a good target language. This made me decide to switch to developing the preprocessor again.


Wednesday, August 21, 2024

Link


Monday, August 19, 2024

'hello world!'

I have been working on a compiler for a small stack based language for the purpose of writing a compiler to replace the MES-compiler of live-bootstrap. This compiler is based on the suggested solution I proposed a week ago. This evening, I succeeded in compiling the program below that prints the text 'hello world!'. The language uses a Reverse Polish Notation for expressions. It allows the definition of functions (with the keyword func), has loops (with the keyword loop and ways to escape it with the keyword break and repeat it at any point with the keyword continue), a choice statement (with the keywords then and else), and definition of local variables (with the keyword var). The program below defines the function fhputs to print a string. The function makes uses of the build-in function sys_fputc that prints a single character to a give destination specified with an integer. In this case the integer '1' is used to reference the standard output. A function is called with '()'. The value that the function sys_fputc returns needs to be deposed with using pop. The program contains the function main, which is the main function that is called when executing the program. It simply call the function fhputs

func fhputs
{
    var s s =
    loop
    {
        s ? ?1 0 == then { break }
        s ? ?1 1 sys_fputc () pop
        s ? 1 + s =
    }
    ret
}

func main
{
    "hello world!" fhputs ()
    ret
}

The compiler is a single pass compiler with minimal storage. It keeps a stack oriented symbol table and a stack for the statement nesting. There is an almost one to one translation to 'machine code' in the format that is excepted by the M1 compiler of stage0-posix that is part of live-bootstrap. The language and the compiler are rather primitive and do not prevent many kinds of errors. The first version of the compiler, which is very much work-in-progress and contains some known bugs, can be found in the commit 590e5315. This commit contains the batch-file build_stack_hello that contains all the calls to compile the hello.sl program and to run it. A number of intermediate files are produced including the file hellosl.txt that is produced by calling objdump.

I am still thinking about how to continue from this point. One thing would be to write the compiler in the language itself. I think this is possible, but I think I first want to develop the C++ version further, before I start doing this.


Saturday, August 17, 2024

Yellow from Bloemendaal

In the harvest from Herenboeren Usseler Es we were given two large paksoi and also two heads (large and small) of "Bloemendaalse Gele" (which translates to "Yellow from Bloemendaal"), an old variety that is somewhere between pointed cabbage and savoy cabbage. It is quite possible that some of my ancestors, who were vegetable growers, also grew it and possibly even cultivated it. In addition (depending on personal choices where possible) I came home with: a spaghetti squash, seven red onions, two leeks, two gherkins, one cucumber, three courgettes, a fennel, a broccoli and two heads of lettuce (with red edge). From the things we were allowed to harvest ourself from the beds, I took some basil and some rocket. We were also asked to help harvest potatoes, but that did not happen. The ground was too wet. I heard someone say that 2 cm of rain fell last night. That could well be because I heard it rain last night.

Meesterwerken

This afternoon, I visited the exhibition 'Meesterwerken' at Fotogalerie Objektief with photographs from ten students from the photographers course at the secondary vocational education instituion 'ROC van Twente'. I liked the photographs by the following students:


Thursday, August 15, 2024

Links


Tuesday, August 13, 2024

Introduction

Diaries
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
2024
2023
2022
-- contact --

Family

Frans
Conny
Annabel
Andy
Li-Xia
Others
Pictures

Collecting

Books
Maps
Bookshelves
Art works
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
Programs
Pluim

Puzzles

Hamilton cycles
cutting sticks
Califlower fractal
more...


SARS-CoV-2

Tracking
Trends
Prediction
nextstrain.org/ncov



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:

Privacy statement

This is a static website with no contact form and no way to add comments. It has no advertisements and no trackers. It does not use cookies. I am not using any method to analyse traffic to this website nor keeping any logs. I am not collecting personal data besides what is published on this website. If you want me to remove any personal data (including your name or link to your website), please contact me by above email address and I will make all effort to remove the data as soon as possible. I am private person and this website does not serve any economic purpose. All cost for maintenance are paid by myself. I do not receive any payments. The website is ad-free and does not have sponsored links.

Site statistics

If I did not count wrong, this site consists of 1065 HTML-files with a total size of 38,981,489 characters, having 82,542 internal links and 17,953 external links to (more than) 5,271 websites. (At least 797 of the external links are broken.) Furthermore, it contains 245 C/C++ program files with a total size of 5,824,689 characters, 11 MySample scripts with a total size of 85,207 characters, 3 PASCAL program files with a total size of 35,259 characters. and 2 Python program files with a total size of 3,764 characters. There are 70 text files with a total size of 753,471 characters. With respect to images, this site containts 1354 JPEG images (total size 61,941,530 bytes), 146 GIF images (total size 3,765,046 bytes), 95 PNG images (total size 2,302,310 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 2 MP3 files with a total size of 8,717,982 bytes. It also contains 43 PostScript files (total size 308,387 bytes), 2 LaTeX files (total size 132,020 characters), 14 PDF files (total size 16,211,832 characters), 22 zip files (total size 2,487,335 bytes), 3 gzipped tar files (total size 52,345 bytes), 45 SGF files with a total size of 85,019 bytes, 168 KML files with a total size of 6,483,813 bytes, 1 bundle files with a total size of 99,918 bytes, and 2 EXE files with a total size of 38,340 bytes. It also uses 19 JavaScript files with a total size of 1,260,118 bytes, This leads to a total size of 153,336,311 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.