I had fun building my own LISP (Slow Loris). The project was extremely easy to get off the ground, because there a ton of resources to do just this. I thought it might be handy to have a little links round-up, based on my research.
There are already several good projects out there on writing your own LISP in Python.
This is a seminal work, that is much referenced. Norvig starts out describing everything that's being built in clear, simple terms, and builds up from the foundation. Lots of working code and examples.
This is an even older and more respectable piece on the topic. This was a bit more theoretical, but still very useful.
And, of course, there are some assorted GitHub projects that build their own LISP in Python.
If you want your LISP to be fast and popular, you probably need to write it in a more low-level language. C is a good option. There is a whole book on this:
If you want a nice (albeit VERY extensive) reference for writing a language in C, the Python language is written in C and the source code is available online:
You can also, of course, import Python code from C:
- Extenind Python - Python.org
- Calling Python Functions from C - Python.org
- Embedding Python in Your C Programs - LinuxJournal
Or maybe you just want to compile your Python-based LISP down using Cython.
The benefit of writing your LISP in C is that you will, theoretically, end up with a faster language. But there are perhaps other benefits that might be more important to you. Portability comes to mind. For your LISP to be truly portable, it would be nice if it ran on a common virtual machine. In that case, perhaps your LISP should be written directly for the Java or Python virtual machine. There is a nice introduction to Python bytecode here:
However, the structure of Python bytecode changes regularly, even in minor language versions. So it would probably be smarter to write for the Java Virtual Machine (JVM), which is less of a moving target. To write a language for the JVM, you will want to reference the Java Specification guide:
There is also a nice StackOverflow answer with a lot of references on writing for the JVM here: