Projects, Technology 2016-08-09

New (old) project: Osprey Forth, an OpenStep Forth

Announcing a revival of an old Forth project: OspreyForth!

I’ve always had an interest in Forth, the unusual programming language created by Charles Moore. It’s unlike anything most web developers, even non-web developers use today and it owns a very small group of enthusiasts. Mostly Forth is used in embedded software where there isn’t enough space for the modern runtimes we’re used to seeing today. That said, Charles Moore believed everyone should make their own personal version of Forth and I intend to.Back in 2006 I married the FICL interpreter to the Objective-C Runtime. It worked, but I was never satisfied with the result. For one thing, while the FICL interpreter’s API was very detailed, I just wasn’t happy with it. Further, FICL is by nature a command-line interpreter. I wanted something that would help me build applications. With that in mind, I’ve turned to pForth. pForth is a public domain Forth with a much simpler API. It was meant to be as portable as possible and therefore is as simple as possible, which makes it as easy as possible for me to conduct my project.

Why “OspreyForth”?

It has to do with the Objective-C Runtime and associated API. Back in the day, Steve Jobs was kicked out of Apple and founded NeXT Computers. There he promoted the NeXTSTEP libraries based on the Objective-C programming language, which in turn was created by Brad Cox and Tom Love. When NeXT didn’t take off, Jobs made a deal with Sun Microsystems (now owned by Oracle) to create an open standard based off of NeXTSTEP called OpenStep. These ideas provided the foundation of Mac OS X and are the basis of GNUStep, the open source answer to Mac OS X’s basic libraries.

I really like the OpenStep/Mac OS X library setup. Well, the version that initially appeared in the early days of Mac OS X. I imagine there’s been significant mutation since then. The fact that the Objective-C API is callable from C and can have any language build a bridge to it makes it too tempting not work with. In any event, “OpenStep” and “Open Source” leads to “OS”, hence OspreyForth.


The original OspreyForth (the FICL/Objective-C version) was built using Objective-C. Objective-C is (or was) as superset of C and therefore it made things a bit easier for me in building the bridge between the two runtimes. This time around I’m planning to go with straight C. This is because pForth is also written in straight C and I don’t want to build a multiple-language bridge. I still have the old code from the FICL version of OspreyForth and many of the calls to the Objective-C Runtime are still in C. Many of the calls that deal with object methods, however, are made using the Objective-C language over the C API. In some cases I bypassed the API completely.

Things to Do

Here is what I think needs to be done so far:

  • Go through the code and copy over the regular C API calls
  • Analyze the Objective-C calls I made and see if I can perform the same tasks in straight C
  • Focus on getting pForth to instantiate and control Objective-C objects. I can take care of actually creating new objects later.
  • Set up a Sourceforge project to hold all the code (I’ve had a Sourceforge account for a while, but I let it all gather dust until now. The project is currently anticipated to be public domain, but I haven’t decided yet.)
  • Pressure-test the new system. Try to use it for some projects

That’s about it for right now. We’ll see what happens as I progress.

Wish me luck!

About the author

Erik Hentell: I started out in theater before moving to graphic design. I eventually moved into web design while trying to expand my knowledge on software development. I currently work for a media company helping with their digital assets such as source code archives and ebooks.