Lisp in 200 Lines
Contrary to popular belief, LISP does not stand for “lots of irritating spurious parenthesis.” However, it is true that people tend to love or hate this venerable programming language. Whichever side of the fence you’re on, many of the ideas it launched decades ago have become staples of other newer languages. How much C code do you think it takes to make a functional LISP system? If you guessed more than 200, you’ll want to go look at this GitHub repository.
Actually, the code isn’t as good as the (sort of) literate programming white paper on the program, but it gives a good overview of how 200 lines of C code can produce a working LISP-like language good enough to create its own eval loop. It does lack memory handling and error detection, so if you really wanted to use it, you’d probably need to spruce it up a bit.
Is this practical? We don’t doubt the educational value, but we were really interested in how it could squeeze into a microcontroller since it is so sparse. While we haven’t tried it, we could see using a PC development tool (coded in proper LISP) to detect errors. Many embedded systems have a pretty static memory footprint, so maybe the lack of memory management would not be a major problem. Then, too, it would be pretty easy to add your own functions for explicit memory management which is probably better for a microcontroller, anyway.
On the other hand, we’ve seen small LISP interpreters before already running on micro-sized hardware. Naturally, if you can do that on an AVR, the ESP8266 can easily match that. What do you with a pint-sized, battery-operated LISP machine? Beats us. We doubt you’ll be moving your Emacs macros to one anytime soon.
Filed under: Software Development, Software Hacks
from Hackaday http://ift.tt/2AOTB5M
via IFTTT