Unfortunately I’ve been busy since deciding to place HST on Google Code, so have not had time for major enhancements. Those ‘enhancements’ I have attempted, proceeded in a rather haphazard fashion and lack direction. This post will help refocus my attention on smaller goals and more disciplined testing.

After adding testing to the basic parser, it is now time to expand the parser’s functionality, adding the ability to handle more features of Smalltalk. I have chosen to add support for more complex message sends. I wish to support multiple keyword/primary pairs so that expressions such as prim a: 'arg1' b: 'arg2' are able to be parsed.

In adding this functionality I take small steps and ensure that testing is kept up to date with the work I carry out. Although at the end of this development the execution engine can not compile, I believe the parser is futher forward than with my previous, rather random, additions.

Read the rest of this entry »

I must admit I’ve liked the concept of QuickCheck ever since I first found it. I tend to write tests that are “too nice” to my code, often missing corner cases and errors caused by strange input. QuickCheck helps me avoid this by generating test data for me. Even in trivial projects it has helped me detect bugs I wouldn’t have found through unit tests written myself.

In this entry I begin testing the parser for HST – A Smalltalk interpreter developed in Haskell (the code developed so far for the parser can be found here and here). To do this I’m going to make use of QuickCheck. I couldn’t find much information on testing a Parsec based parser using QuickCheck, but I’ll have a go and see what happens.

The approach I’ve decided to try here is to have QuickCheck randomly generate an instance of the Abstract Syntax Tree (AST) I’ve developed. I’ll develop a pretty printer that can convert this to a String. Parsing the String should then result in the originally generated AST. I’m not entirely sure this will work, but at least it should give me a good starting point.

Read the rest of this entry »