Posts in CastleBlogs

QuickNote: Connecting two ports

Like in QN: Sending Events, we collect here some lines/fragments about connecting two ports in the handCompiled code to find similarities, and to design the (Jinja) templates.

Read more ...

QuickNote: Sending Events & Machinery

Depending on the The Machinery (ToDo), the generated code to send an events will alter. However, only a little bit as we will see in this study.

Read more ...

QuickNote: Jinja Events (templating)

As we have seen in the recent Workshop blog: QuickNotes a lot of code (to send/handle events) is always the same, but for some details. A template engine, like Jinja, can help in that.

Let’s study how those templates can help us.

Read more ...

QuickNote: Sending Events (generated code)

The handCompiled, generated to send an event is about 4 to 6 lines; depending on the The Machinery (ToDo), with a lot of similarity. It is however buried in lot of other code, notes, ect. And therefore hard to see the difference.

Here, we collect al those pieces, and see which lines/fragments are common – and can go into a template. And which parts we have to fill-in.

Read more ...


In Castle, one can dynamically connect components and send “events” over those connections. Typically this is done as an action on an incoming message (see: The Actor Model). And depending on ‘The Machinery (ToDo)’, those events can be queued. It is this combination that can result in a beautiful Heisenbug.

First, let’s explain the Heisenbug, before we give an example. Then we analyze it, show how to improve the code, and finally formulate a requirement to prevent & detect this kind of bug in Castle.

Read more ...

QuickNote: Arpeggio

In this short QuickNote, we give a bit of info on Arpeggio; a python package to implement a (PEG) parser. Eventually, the parser is written in Castle – like all Workshop Tools. To kickstart, we use python and python-packages. Where arpeggio is one of the options.

As Arpeggio is quite well documented this is a short note. We also describe some differences with the Pegen package.

Read more ...

QuickNote: PEGEN

To implement CCastle we need a parser, as part of the compiler. Eventually, that parser will be written in Castle. For now, we kickstart it in python; which has several packages that can assist us. As we like to use a PEG one, there are a few options. Arpeggio is well known, and has some nice options – but can’t handle left recursion – like most PEG-parsers.

Recently python itself uses a PEG parser, that supports left recursion (which is a recent development). That parser is also available as a package: pegen; but hardly documented.

Read more ...