ScopesSaturday, Mar 10, 2018 · 700 words · approx 3 mins to read
From my first ever code in Acorn-flavour BASIC, I’ve always tried out programming in new languages whenever the urge strikes. I’ve coded in dozens over the years, a tiny handful to the point where I’ve been confident enough to use them professionally, but most to a point where I’ve explored them a little and maybe written some toy programs to get a feel for using them for something more tangible.
The reasons for trying something new are legion. Boredom is a big one! Looking at new ways to make a computer do something when you’re struggling to figure out what to do next, even if you have a laundry list of tasks that stretches out in front of you for months, is an enjoyment I’ve always taken.
As software arguably eats the world, taking some time here and there to work out how other languages get the job done is also incredibly interesting and valuable, even if you mostly program in one particular established language.
I don’t know if it’ll be the same for you, if you’re a programmer too, but it’s not just the languages that interest me in many cases. Rather it’s the other aspects that often come along with one: tooling, IDEs, visual systems, documentation systems, multi-platform support; the list goes on. Those myriad extra avenues to explore alongside a new language are often as fun and exciting as exploring the language itself.
That brings me on to Scopes, a small language — and by small I mean minimal syntax, not minimally useful! — invented by Leonard Ritter as part of the infrastructure for a game he’s developing. I have no real idea what I’d ever build in Scopes, or even if I could build something useful at all, but it’s intellectually interesting because he’s built it from scratch on top of a compiler and language technology that I’ve been fascinated by for a long time, and that is increasingly used by my employer to build the compilers for our GPU and CPU products.
So the hook to add it to the list above was obvious; learn about Scopes and it’ll help me learn a bit more about how LLVM works. To scratch that itch I needed to do something I’ve never had to do before with a new programming language: make it work on my computer first!
Because Scopes is so young, Leonard has only engineered support for the two platforms he cares the most about. macOS won’t be in the top two of anyone’s list of operating systems to support if they’re shipping a game, unfortunately, so I can’t be mad, plus it was a chance to get to know how Scopes works a bit better. After all, there’s no substitute to learning how something works than to have to fix it.
Thankfully one of the platforms that Scopes does support, Linux, is close enough to macOS in underlying tooling and philosophy that bringing up macOS support was pretty easy. Leonard and another Scopes user, James Austin, helped me put the patchset together for the pull request, so all I really did was clean that stuff up a bit, do some testing, and write some documentation. All valuable efforts for a fledgling language though, and lots of fun.
So if you clone Scopes from tip now, it’ll build and run on modern macOS if you follow the new instructions. I hope you give it a try, even if it’s just to do what I did and pass the time while learning about something interesting.