Lisp is one of those interesting computer languages that you either love or hate. But it has certainly stood the test of time. Of all the ancient languages that are still in practical use, only FORTRAN is older, and only by one year. If you ever wanted to learn Lisp, [Kanaka] has an interesting approach: Study how to build your own Lisp in your favorite language.
What if your favorite language is something obscure? [Kanaka’s] GitHub page has no fewer than 64 different implementations of Mal (Make a Lisp), each in a different language. Unsurprisingly, C and Python are on the list. However, so is Forth and Go and Awk. Not strange enough for you? How about Make? Yes, Make, like you use to build programs. Bash, Postscript, and even VHDL have entries, although–surprisingly–no Verilog; we don’t know why.
Each implementation of Mal is separated into eleven incremental, self-contained, and testable steps that demonstrate core concepts of Lisp. The last step can actually run a copy of itself–typical for a mind-bending language like Lisp. There is a guide to help you navigate through the process in the language of your choice. The suggestion is to not look at the code in the repository until after you’ve written it yourself. You can see [Kanaka] (also known as [Joel Martin]) giving a recent talk about the Mal process in the videos below.
Continue reading “Hack your own Lisp Language Using… Well… Anything”
Lisp is a supremely elegant programming language, but you won’t find it around much today. That’s a shame; in the 80s and 90s, all the cool kids were using Lisp machines, computers dedicated to the creation and interpretation of Lisp. While the AI renaissance of the 80s is dead, replaced with the machine learning fad of today, Lisp machines have gotten much smaller. Now, they’ll fit in your pocket, and they have parenthesis matching, to boot.
If this build looks familiar, you’re not wrong. A while back, we saw a similar pocket Lisp computer based around the ATMega328 microcontroller with 32k of Flash and 2k of RAM. That’s not a lot by any measure, and a much more suitable processor for an AVR-based pocket Lisp machine would be the big boys of the ATMega family.
The new and improved version of the Tiny Lisp Computer is built around the ATMega1284. If it’s capable enough to run a 3D printer, it should run Lisp very well. With more program space and more RAM come more features including matching parens when entering code, a serial monitor interface, and a program editor – basically a text editor on the chip.
Apart from the larger chip, the circuit remains relatively unchanged. The display is still an OLED that can be had for a few dollars from the usual online retailers, and the other bits of circuitry are still just a handful of resistors, caps, and wire. An off-the-shelf FTDI module (or whatever serial chip you desire) can be added to connect to a serial terminal, and support for a PS/2 keyboard rounds out the board.
LISP is a polarizing language. Either you love it or you hate it. But we’ll put aside our personal preferences to bring you a good hack. In this case a LISP environment running on an ESP8266. [Dmitry] is on the “love it” side of the fence — he’s been waiting for an excuse to code up a LISP interpreter for a while, and he found one in the ESP8266.
One weekend bled into the next, but he got the system running, connected to the network, and had LEDs blinking! In the end, he even managed to squeeze in some optimization for memory’s sake. Pretty cool, and because it takes advantage of an already complete system, it can even be made pretty useful. Not bad for a few weekends’ work!
And finally, if Lots of Irritating Silly Parentheses is your idea of a good time, but the wealth of computing resources available on an ESP8266 seem overkill, have a look at Microlisp, running on an AVR. Or go to the opposite extreme, and run a LISP OS on a Raspberry Pi. Whatever you do, don’t forget to close your parentheses! (We’re told that’s a traditional LISPer farewell.)
We’ve seen tiny microcontroller-based computers before, but nothing like this. Where the usual AVR + display + serial connection features BASIC, Forth, or another forgotten language from the annals of computer history, this project turns an AVR into a Lisp machine.
The μλ project is the product of several decades of playing with Lisp on the university mainframe, finding a Lisp interpreter for the 6800 in Byte, and writing a few lisp applications using the Macintosh Toolbox. While this experience gave the author a handle on Lisp running on memory-constrained systems, MicroLisp is running on an ATMega328 with 32k of Flash and 2k of RAM. In that tiny space, this tiny computer can blink a few boards, write to an OLED display, and read a PS/2 keyboard.
The circuit is simple enough to fit on a breadboard, but the real trick here is the firmware. A large subset of Lisp is supported, as is analog and digitalRead, analog and digitalWrite, I2C, SPI, and a serial interface. It’s an amazing piece of work that’s just begging to be slapped together on a piece of perfboard, if only to have a pocket-sized Lisp machine.
Thanks [gir] for the tip.
On the scale of awesomeness, writing an operating system ranks near the top for software hackers and ranks just below writing a whole new language. [Lukas F. Hartmann] is reaching for the epic status with the Raspberry Pi operating system dubbed Interim. In an interesting mixture of old and new, it’s written in LISP!
LISP (LISt Processing) is the second oldest high-level programming language that received wide-spread usage. The only one older is FORTRAN (FORMula TRANslation), and that is just by one year. LISP is generally associated with artificial intelligence research but it also surfaced as a utilitarian scripting language in various applications like AutoCad. You may have also heard of a more recent dialect, Clojure, which has been receiving a lot of attention.
The source code, an image for the Pi 2, and directions for making it all work are available. [Lukas] also describes how to get a new OS up and running on a Pi.
[Lukas] isn’t the first to create this type of system. Back in the ’70s MIT worked on a Lisp machine that led to commercially available systems. If you have an old Apple IIe around you can make it into a Lisp Machine. You can also find LISP in the Internet of Things. And then there is [kremlint] who actually scored an original LISP Machine. We’ll have to keep an eye on his progress in restoring it to working condition.
Thanks for the tip, [krs013].
Using routers as dev boards has been a long and cherished tradition in the circles we frequent, and finally design houses in China are taking notice. There have been a few ‘Internet of Things’ boards in recent months that have taken the SoC found in low-end routers, packaged the on a board with USB, some GPIOs, and a fair bit of memory and called it a dev board. The ZERO Plus is not an exception to this trend, but it does include a very interesting feature when it comes to the development environment: this one uses Lisp as its native language.
The Zero Plus is pretty much what you would expect from a router SoC being transplanted to an Internet of Things board: it uses the Ralink RT5350 SoC, giving it 802.11b/g/n, has 32MB of RAM, 8 or 16 M of Flash, I2C, I2S, SPI, USB, two UARTs, and 14 GPIOs. There is support for a webcam, temperature and humidity sensor, displays, and Arduino via a breakout board that appears to contain a standard, DIP-sized ATMega328,
All of that could be found in dozens of other boards, though. What really sets this one apart is the Lisp development environment. Programming the Zero is exactly as elegant as you would expect, with a ‘toggle a LED according to what time it is’ program looking something like this:
(define LED_On (lambda ()(dev.gpio 11 "out" 1)))
(define LED_Off (lambda ()(dev.gpio 11 "out" 0)))
(define CurrentTime? (lambda ()
(int (time.strftime "%H" (time.localtime (time.time))))))
(> ( CurrentTime? ) 16) (< ( CurrentTime? ) 23)
(if (Night?) (LED_On) (LED_Off)
Way back in the late 1970s and early 1980s, a few very awesome people around MIT were working on Lisp machines. These computers were designed specifically to run Lisp as their main programming language. Around the same time, a few [Steves] in California were working on the Apple II, which would soon become one of the most popular computers of all time. The Apple II ran BASIC as its main programming language, fine for the time, but surely not as elegant as Lisp. It took more than 30 years, but [Alex] and [Martin] figured out a way to turn the lowly Apple IIe into a Lisp machine.
Developing Lisp for the Apple IIe was surprisingly easy for these guys – they simply wrote a Lisp interpreter in C and used a 6502 compiler to generate some machine code. The main problem of porting Lisp to an Apple II was simply getting the code onto the Apple. We’re assuming this would have been easier had the same project been attempted in the 80s.
To get their interpreter onto the Apple, they used the very awesome ADTPro library that allows data to be loaded onto an Apple II via the cassette port and a modern computer’s microphone and speaker jack. After a solid minute of loading analog data onto this digital dinosaur, [Alex] and [Martin] had a Lisp interpreter running on ancient yet elegant hardware.
The source for the 6502 Lisp interpreter can be found on the GitHub along with all the necessary tools to load it via a modern computer. That’ll give you all the ancient lambdas and parens you could ever want. One warning, though: backspace doesn’t exactly work, so be prepared for a lot of frustration.
You can check out the demo video below.
Continue reading “The Apple IIe Becomes a Lisp Machine”