Re:Building a Lisp from scratch with Swift
by taejo on Monday February 06, 2017 @04:28AM
(#13577916)
> anything else that requires a real call stack (exception tracebacks, for example).
You can go full metacircular and have the interpreter throw an exception and introspect its traceback, in languages that support that.
One benefit of this is that continuations become trivial to implement (they're just a snapshot of the call stack at a given point).
Admittedly, almost all write-your-own-Lisp tutorials omit this, and use a bunch of recursive calls (in the implementation language) instead, which makes it very hard to do TCO, continuations or anything else that requires a real call stack (exception tracebacks, for example).
(I hope this answer makes sense; it's 3 in the morning here, so clarity might suffer a bit. ;-) But as it happens, I am writing a (hopefully non-toy) Lisp interpreter myself, in Go, so the question attracted my interest.