Roads Less Taken

A blend of programming, boats and life.

Fowltalk - a New Smalltalk

| Comments

In my quest making Spry I also learned about other efforts in the Nim community to construct Smalltalk-like dynamic languages. The most ambitious one may be Fowltalk by “fowl” who typically hangs out in the #nim channel on Freenode. Fowltalk started out written in Nim but since fowl wanted to learn more C++ it’s now written in C++17.

At the moment he is rewriting the parser and code generator parts in the language itself, following a similar bootstrapping style as Ian Piumarta’s idst. For example, here is the method parsing keyword messages.

At the moment Fowltalk is nowhere near usefulness but its fun stuff!

It’s interesting to look at these bootstrap* files - we can immediately notice some syntactic differences to Smalltalk-80:

Block arguments are written like [| :x :y | ... ] and you can mix both locals and params there: [| :aParam aLocalHasNoColon | ... ]. Instinctively I can agree with the combination, but I would probably then make the first | optional.

Some messages have been changed, like ifTrue:ifFalse: is instead ifTrue:else:. I have done similar simplifications in Spry. And just like in Spry ivars are referenced using @myIvar.

There isn’t any documentation on Fowltalk yet, but it’s clearly a rather elaborate implementation. It compiles to bytecodes, uses numbered primitives (I think) and there is an image mechanism.

It was also quite easy to get the REPL up and running, but just as with Spry, it’s hard to know how to use it! On Ubuntu I installed boost sudo apt-get install libboost1.58-dev and then it was easy to get it running following the instructions, as long as you change setup-linenoise.sh to setup_linenoise.sh.

The image constructed by the bootstrap process is 67Mb in size. Then we can do the canonical Smalltalk test in the REPL:

1
2
3
4
5
6
gokr@yoda:~/fowltalk/idk$ ./bin/oop -i oop.img --mmap --repl
> (3 + 4) print
7

> !quit
gokr@yoda:~/fowltalk/idk$

Fowl mentioned that the new parser can be loaded using !read bootstrap.1 but… at the moment that causes errors.

It will be interesting to see where this goes! Fowltalk is very early in its evolution, and it’s not a JIT, but it’s a real bytecode VM with an image and we can never have enough Smalltalk-like languages! :)

Comments