16 comments

[ 2.9 ms ] story [ 54.2 ms ] thread
I love the abuse of turing complete tools. It's a weird perversion that I'm starting to appreciate more.
A part of me loves and a part of me hates the author.

10/10 would lithp again.

> There should be a lot of limitations. makelisp behaves very strangely when you pass a broken Lisp code.

I can't imagine why..

I'd love if make was less capable of implementing a toy Lisp and more capable of quoting characters. Like quoting a left paren. I mean, at all.
IN GNU make there's \( , $(\() and lparen := \( ... $(lparen) .
\) didn't work for me (may depend on the context, don't know), and some Google searches and Stackoverflow answers later I settled for LEFTPAREN:=) and $(LEFTPAREN)
I think we should acknowledge how impressive it is implementing a Lisp of all languages in a language that doesn't let you easily quote parens!
This reminds me of MAL [1], which stands for "Make A Lisp" or Make, A Lisp" depending on whether you're talking about the whole project or just the make version. It branched out into being implementations of a lisp in over two dozen languages, with instructions to help in writing your own. I was working on a haxe version before my motherboard recently bit the dust.

[1] https://github.com/kanaka/mal

And yet there is Racket which is 100% making your own language based on Lisp. Serious question. Why is there mal when we already have Racket?
I think there may be a misunderstanding here - mal is not the language you make the lisp (or any other language) in, it is the language you are implementing. Indeed, there is an implementation in Racket, and even in mal itself.

The point of mal is to guide an implementer through the steps necessary for making an interpreter using a language they are comfortable in. It gives some insight into how various constructs are implemented, such as closures and tail call optimization. The purpose is not so much to make a lisp-like language (although that is the outcome), but to learn what goes into making an interpreter for one - especially when you can't lean on the constructs that already exist in the host language.

I bet this was inspired by the "Lisp in your language" post from last week, where somebody did it in JavaScript.

That got me to work on a Python version (using tuples, for maximum parentheses), but it got put on the back burner because my life took a turn for the busy lately.

A while back I implemented Conway's Game of Life in make... by writing it in a custom high level language and then writing a compiler into GNU Make script:

http://cowlark.com/2013-10-19-insane-make

I also wrote an arbitrary precision maths library, because make doesn't support arithmetic. I got as far as addition, subtraction and multiplication before coming to my senses.