I just realized I haven’t posted anything really serious about Smile in all of 2017. I’m definitely overdue for a status update! There have been over 360 commits in it this year, more than one commit per day (on average).
Everything Old Is New Again
So what’s happened? A lot! Here are some major rundowns:
- The C-based interpreter is something like 80% working. Most critical functionality is now implemented.
- The lexical analyzer and static parser are done (I think). The dynamic parser is mostly done, give or take some bugs.
- The compiler (which turns the Lisp forms into bytecode) is mostly done.
- Eval (which runs the bytecode) is mostly done.
- Major types, like String, Char, Uni, Byte, Integer16, Integer32, Integer64, Real32, Real64, Float32, Float64, List, Symbol, ByteArray, are all implemented, and most of the methods on them work.
- Several of the most important types (the integers, the reals/floats, String, and List) have a very large library of useful methods on them now.
- Critical core constructs like functions, assignments, conditionals, loops, lists, and user objects all do what they’re supposed to (with unit tests to prove it!).
- Basic I/O has been implemented, although it’s really a lot more O than I right now.
- Important concepts like lexical closures and #syntax transformations and object-method lookups are implemented and working.
- The interpreter builds and runs on both Windows and Linux, 32-bit and 64-bit. (Unit tests pass too!)
- Many of the Lispiest concepts all work as expected, including quoting, templates, cxr/cons and friends, and symbols.
- The interpreter is both “stackless” and interruptible: It uses constant space on the C stack and its complete state exists on the C heap. Recursion is handled by custom stack logic.
- All the methods that could call back into the interpreter, like Integer64Range.each and List.map, have been implemented using state machines.
- Lots of work to make Unicode and UTF-8 proper first-class citizens throughout the codebase. Out of the starting gate, most European languages should feel right at home in Smile (and there are future plans for supporting CJK and Russian and Hebrew and Arabic and a whole host more; I just don’t know them all well enough to support them initially).
Which is to say that as of October 2017, the C-based interpreter is now roughly where the C#-based interpreter was in October 2014, or probably a little ahead of it because of the new interpreter’s bytecode-compiled and stackless nature.
But What Have You Done For Me Lately?
That’s not to say nothing else has happened in the interim: A lot of critical language details have been nailed down harder than they were before, and some small design flaws were fixed. And the new interpreter runs circles around the old one; it’s fast enough that you could seriously consider using Smile for real coding soon.
Also, I’m now live-coding every Thursday night on Twitch so if you want to see me build some parts of Smile live, just tune in from 9:00 PM to 11:00 PM US Eastern Time on Thursday night.
Several demo programs now work. There’s the ubiquitous Hello, World and some toys like Fizzbuzz, but Ben’s (in)famous Fractal program (which generates a Mandelbrot fractal) now runs too, which is a great test of the language’s math abilities. I have Ben’s original in the repository, as well as a more map-reducey-style version of it to show what it’d be like taking advantage of a little more of Smile’s natural abilities. That’s certainly not a full demo of everything that the language can do, but the fractal program does at least give a feel of some of the iterative parts of it.
Hello, world? Hello, world!
#include "stdio" Stdout print "Hello, World\n"
A Few Provisos, A Couple Of Quid Pro Quos…
All that said, there are still some things in need of attention in the core part of the interpreter:
- #syntax transforms don’t evaluate templates properly, so you can’t even leave out the “Stdout” yet in Hello, World.
- The macro keyword doesn’t do anything yet, much less actually declare macro functions and allow them to resolve at run-time.
- till loops only work in the most trivial cases; the escape-continuation form doesn’t work at all yet.
- try/catch neither compiles nor evaluates (it parses, though).
- User exceptions don’t work at all yet.
- There’s no support for regular expressions, embedded JSON or XML data, or any of the other “loanword” constructs.
- The I/O support is pretty iffy right now.
- User file-includes don’t work right yet either.
Still, I’ve made a lot of progress. You can run some things in the Smile interpreter now. It won’t be that much longer before I’m able to kick off smile-lang.org for real (y’all know I’ve owned that domain for years, right?), since some of its pages were written using the slow old C# implementation of Smile. There are a lot of hidden pages on that site documenting the language and its features; I’m trying to ensure that when I make it publicly available, there’ll be enough documentation that people can feel comfortable with giving Smile a try. That’ll be the official launch, after which you can all grab it and begin complaining about the bugs and missing features and design decisions.
That said, the Smile C interpreter has been on GitHub since I started coding it, and if you’re ambitious, you’re welcome to git clone a copy, compile it, and give the language a spin.
Just remember, if you do try it, that there’s a reason that its version number is pinned right now at v0.1, okay? 😉