- Common Lisp 48.7%
- Swift 47.8%
- Python 2.2%
- Makefile 0.6%
- NewLisp 0.5%
- Other 0.2%
| _morgue | ||
| div | ||
| doc | ||
| external | ||
| old-regtests | ||
| src | ||
| .gitignore | ||
| Capabilities.md | ||
| LICENSE | ||
| Makefile | ||
| PLAN.md | ||
| README.md | ||
Lisp in Swift
This is a simple Lisp interpreter written in Swift, in some degree of incompleteness.
Update 2026-09-29:
Disheartened by the hermetic complicacy of Swift's system libraries (Core Foundation etc.), I stopped doing this and instead implemented "lyk" in Kotlin. The libraries looked good, and I would in the worst case fall back to the Java libraries, which are a well-known quantity. I made a lot of progress with lyk, until it was the most complete (albeit still naïve at the core) Lisp interpreter I had made.
To make it a system programming language, I started to add more Unix/POSIX-type functionality, but finally discovered that this is difficult on the Kotlin/Java basis. A third-party POSIX library exists, but that adds another dependency I'd rather avoid. And then I never got quite as warm with Kotlin as a language as with Swift. (More about that in the Plan.)
So, back to Swift. To my surprise I found out that Swift's "Darwin" package apparently has all the Unix/POSIX functionality I want. A closer look reveals, though, that these are barely adapted to Swift (using Swift datatypes and conventions) and on top of that barely documented. But still, that seems workable.
After -- to a varying degree -- not being blissfully happy with Modula 2, C, Java, Perl, Go, and Python for this application, it was time to try this pet project of mine in another language. Once I wrote an article https://jyrgenn.dreamwidth.org/30953.html pondering the choice of a programming language, and I excluded Swift, because it wasn't open source and not widely available. This has changed in between. In between it is open source and available on macOS and Linux; a FreeBSD port has gone stale, but that is no longer my platform of choice (sadly). All the world's Linux anyway, right?
Swift has the chance to be what I was looking for -- it is fast (not as fast as C or Java, but way faster than e.g. Perl, let alone Python), has static type checking, at least simple type inference, AFAIK some approach to parallelism, automatic memory management, and does not seem to be a pain in the ass. Syntax and semantics seem to be rather clear and well-defined, and it seems to have not too much boilerplate (am not as far to judge that).
So it was time to give it a shot. First impression was good; certainly better than Nim (or Julia or Crystal), which kind of rubbed me the wrong way here and there. That is one aspect of a programming language I hadn't mentioned in the above-mentioned article -- I must be able to bend my mind around it. That seemed to be the problem with Nim, with which I found that difficult, and I did not like it. This does not seem to be the problem with Swift.
Swift's concepts seem straightforward, easy to understand, and well designed for me, and I find it easy to use them in my code. It has been fun from the beginning, because I don't seem to run into major obstacles. It feels a bit similar to Python in parts, which I also found fun to work with from the start. Only here, with strong typing and very explicit error handling, it feels like I get the code more right from the start. I like that.