PetitParser for GNU Smalltalk


On and off the last couple of weeks I have ported PetitParser to GNU Smalltalk. I am still a Smalltalk newbie and it was a nice learning experience and it helped me to improve the way I code on GNU Smalltalk and to learn more about GNU Smalltalk and ANSI Smalltalk.

To load the one can type:

To load the into the image do:
PackageLoader fileInPackage: 'PetitParser'

There are some differences between the real PetitParser and this port. GNU Smalltalk does not support binary selectors that have more than two charachters. This means that ==> and >=> had to be mapped to something else. I have picked => and >< for now.

In GNU Smalltalk we are using gst-convert to convert from Squeak syntax to the GNU Smalltalk syntax (it can do more than that as well). The first obstacle was that our Parser could not handle the PetitParser code, it was using classSide which STClassLoader has not seen before and then failed, Paolo was nice enough to come up with a patch for that, the second issue were binary selectors of length > 2. I had the pleasure to read the ANSI Smalltalk draft, come to the conclusion that it is legal, come up with a patch to the VM anf the Parser written in Smalltalk. In the end we have only merged the code to understand these binary selectors when they come from Squeak.

The next step for me was to get the PetitTests passing on GNU Smalltalk. I ran into the problem that on Pharo #abc = 'abc' is true, but not on GNU Smalltalk, I worked on VisualGST to have a nicer to debug the tests from the SUnit GUI and that has greatly increased my productivty.

I have learned a lot during this excercise, and with some more work on VisualGST it can be a really nice Smalltalk IDE. I am now trying to implement the Media Gateway Control Protocol (MGCP) Grammar with PetitParser and will see how this goes.

Would you mind informing us what PetitParser is?

Apparently it is described on Lukas Renggli's weblog, and source located at

User login