4 ms·
ThinLisp (Threaded Interpreted Lisp) and Microprocessors
The Raspberry Pi 4 now has 8 Gigs of memory, more than my laptops. It has dual HDMI, multiple USB 2/3 ports, Ethernet, WiFi, etc. It's a big device. It is clearly a great Lisp platform.
The Raspberry Pi 4 has a couple dozen I/O pins, Digital to Analog and Analog to Digital conversion, 3.3 and 5 Volt sources, pulse width modulation, SPI, I2C, UART, and other protocols, timers, and "hats" that allow things like motor control. It is a small device. It is clearly a great Forth platform.
Lisp is a small language, defined in half a page of code. Forth is a small language. So what happens if we combine them? Suddenly we have a Lisp with native hardware control that can drive real-time devices. We also have a Forth with macros, garbage collection, and scope.
Th(readed)In(terpreted)Lisp ... Thinlisp.
This is a language that can combine the best of both worlds. As a bonus, it can self-modify since the interpreter is memory resident.
The game is to "unify the languages" by making conventions. For example, Forth has a DUP function that will duplicate the top of stack. We could call this from Lisp with (DUP) but that would be inelegant. Perhaps the convention that symbols that are all uppercase get interpreted as Forth words so DUP implies (DUP). Further, all functions implicitly have the stack as an additional, un-named parameter so DUP can do stack operations "under the covers".
Leveraging the power of both languages in a very small kernel is an interesting design problem. The game is to make it "elegant".
I love interesting design problems.
- gus_massa 5y agoDo you have a working prototype? (There is no link in the post.)
- daly 5y agoI have a "prototype" but it is still in the truly hacky stage. When I have a decent "first draft" I'll post a github link. I want to try it on a range of microprocessors. Some of them, like the Arduino, have strange memory layouts. I just figured out how to write assembler code for the Arduino.
- johndoe0815 5y agoThat sounds quite interesting! Interim OS for the Raspberry Pi (http://interim-os.com/ http://interim-os.com/) might be interesting to look at for inspiration or maybe a basis for your project.
- kazinator 5y agoThinlisp is the name of an existing project that has been inactive for some two decades now: https://sourceforge.net/projects/thinlisp/ https://sourceforge.net/projects/thinlisp/ https://github.com/ska80/thinlisp https://github.com/ska80/thinlisp It's subset of Common Lisp that compiles to C that runs without garbage collection, developed by a Jim Ballard.
- daly 5y agoThat's interesting. I'll look at it. Thanks.