He he, I wrote a (primitive) Lisp interpreter in Python once. It was crappy and really slow, but it had lexical scoping and a (naive) macro system. Fun times... ;-)
I've become interested in Lisp every couple of years. This fall I even learned Clojure and implemented a Lisp interpreter in Python. I searched a lot for any open-source Lisp implementation in assembly, but found none. Here it is!
I thought a lot about bootstrapping, too, since apparently almost every compiler is written in C these days. Somewhere I got the idea that in the 1970s someone wrote a compiler in assembly and that was used to bootstrap the first C compiler. Guess I'm a romantic, but for me it's important that we know how to get where we are now. Having a high-level language implemented in assembly is quite essential to that, IMO.
I think there's a separate Lisp lineage anyway, wherein someone in the 1960s wrote a minimal machine-code interpreter, and ever since lispers have been writing interpreters on top of other Lisps and revising them to emit compiled code along the way. We would still have Lisp compilers if C never existed.
For anyone wanting to try something similar yourself, I highly recommend MAL. It's a Lisp dialect designed to be a learning tool: there's a nice guide for implementing the interpreter. It doesn't take much away from the learning, but it really lessens the possible frustration a lot.
https://github.com/kanaka/mal/blob/master/process/guide.md
I'm curious whether folks think the ideas of LISP are still resonant and powerful in the startup world and wider industry.
This is different from the question of inspiration. Yes, I admire.
Does PG, for instance, still think that startups can have 'secret' technical advantages and use strategies like 'running upstairs', i.e. choosing to do hard things as a competitive advantage.
By ideas of LISP I mean things like programs-as-data and a small kernel from which the system is bootstrapped.
29 comments
[ 3.0 ms ] story [ 53.1 ms ] threadhttps://news.ycombinator.com/item?id=1745322
(and many re-submissions after that)
Follow up:
https://news.ycombinator.com/item?id=1746916
(how (in 'python (write (interpreter 'lisp))
:-P
“how?” is not a predicate (i.e. something that returns a Boolean value), so it wouldn't be named howp.
A minimal version would be more like:
# REPL
def interpret_lisp():
where those functions would have to be defined, of course.:)
I tweeted the repo link to the HyLang account.
Inspired by Jonesforth, I wrote a complete Lisp interpreter in a single ARM assembly file: https://github.com/marcpaq/arpilisp
Thanks for the compliment and the link to TSTC. I'll add it to my personal list.
While quickly reading through it, my first idea was getting the PI to boot directly to it. :)
I've failed more than once to wrap my stupid brain around lisp but after reading your code, something clicked. I dare say I think I get it! https://github.com/marcpaq/arpilisp/blob/master/arpilisp.s
It's all extraordinarily clean and clear (and must set a new world record for most thorough comment --1120 lines!)
I've become interested in Lisp every couple of years. This fall I even learned Clojure and implemented a Lisp interpreter in Python. I searched a lot for any open-source Lisp implementation in assembly, but found none. Here it is!
I thought a lot about bootstrapping, too, since apparently almost every compiler is written in C these days. Somewhere I got the idea that in the 1970s someone wrote a compiler in assembly and that was used to bootstrap the first C compiler. Guess I'm a romantic, but for me it's important that we know how to get where we are now. Having a high-level language implemented in assembly is quite essential to that, IMO.
https://github.com/keithgabryelski/plisp
it's not meant to be pythonic -- it's meant to readable and organized
my inspiration was Interpreting LISP by Gary D. Knott written in 1997 (the pdf of it is included in the repository)
https://inst.eecs.berkeley.edu/~cs61a/fa14/proj/scheme/ (no link for the current semester is up yet)
Just in case anyone is interested, here's my implementation in Python 3.5+. I'm guessing it took me about 15 hours to write. https://github.com/dancek/mal/tree/python3-dancek/python3-da...
Of course, Peter Norvig's followup to the linked article may also interest anyone who read this far: http://norvig.com/lispy2.html
I'm curious whether folks think the ideas of LISP are still resonant and powerful in the startup world and wider industry.
This is different from the question of inspiration. Yes, I admire.
Does PG, for instance, still think that startups can have 'secret' technical advantages and use strategies like 'running upstairs', i.e. choosing to do hard things as a competitive advantage.
By ideas of LISP I mean things like programs-as-data and a small kernel from which the system is bootstrapped.