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 »


HST now at Google Code

August 10, 2007

I have just set up a project at Google Code for HST – A Smalltalk interpreter developed in Haskell. This is earlier than I initially planned, but I think that it’s impossible to be too early, even though there is only just enough code to run Hello World at the moment. The project can be accessed at http://code.google.com/p/hst

I have not had a chance to set up much as far as web pages go, but the code I have so far is checked in and a discussion list is set up.

I hope to continue add functionality it in the coming weeks, and have some blog entries on some of the more interesting changes.

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 »

Completing the Spike

July 23, 2007

This entry continues work on the Spike Solution for HST – a simple Smalltalk interpreter developed in Haskell. In my previous two posts, I developed a parser that was able to parse a Smalltalk version of ‘Hello World’. In this entry I begin developing the execution phase.

I’m going to continue with my approach of keeping it simple and naive for now. I’m aiming for an interpreter than can parse and execute ‘Hello World’ before I begin adding features and improving robustness.

Read the rest of this entry »

To start gaining experience with Parsec and Haskell I completed the first working version of a parser for SmallTalk’s version of ‘Hello World’. To follow up I decided it would be worthwhile getting advice on those parts that just didn’t feel right. Off to Haskell Cafe I went.

I had only heard good things about the Haskell community, and after my experience I have nothing to say to the contrary. My post and the follow up responses can be found here. Thanks to all those that responded.

Read the rest of this entry »

First go with Parsec

June 19, 2007

Parsec is a library I’ve been interested in trying out seriously since I discovered it. I have written basic parsers for Java projects before and it has not been fun. The Parsec examples I’ve seen have captured my interest. So, now that I’ve decided I’d like to start a decent sized Haskell project I looked for something where Parsec would be involved.

This post describes the result of my first attempts at using the Parsec library for something semi serious. It’s not intended as a tutorial or introduction to Parsec, but to show how simple and straight forward it can be to use.

Read the rest of this entry »