
Make your own Lisp - macco
https://github.com/kanaka/mal/
======
krat0sprakhar
If someone's looking for a more hand-holded approach for building a Lisp in C,
I'd recommend:
[http://www.buildyourownlisp.com/](http://www.buildyourownlisp.com/)

~~~
dptd
I have this page on my "TODO" list. What is your opinion about it? I see
already that you are recommending it but maybe you can give some more details.
Thanks in advance.

~~~
marcpaq
It starts you from scratch and I'd say it's well done, maybe even be overdone
for Lisp. But you get a good introduction to the essentials of language
implementation for more complicated languages.

Shameless self-promotion: I wrote a Lisp interpreter in a single assembly file
for Raspberry Pi. It also starts from scratch at an even lower level, to the
point of ignoring standard libraries.

[https://github.com/marcpaq/arpilisp](https://github.com/marcpaq/arpilisp)

I was inspired by jonesforth, which, if you haven't read it, is a beautiful
piece of work.

~~~
movedx
Great work on this! I've not touched ASM in nearly 20 years (I first learnt C
and then a bit of ASM to crack software using Softice!)

This really makes me want to blow the dust off the RaspberryPi (we all bought
one and never used it: admit it) and get this up and running, just to see it
working.

------
Wildgoose
I immediately thought of Shen which is also ported to a large number of
languages. Shen relies on a "micro-Lisp" substrate called K-Lambda which
consists of just 43 easily ported instructions.

[http://www.shenlanguage.org/](http://www.shenlanguage.org/)

------
agentgt
I had to see if their own language (mal) implemented itself (ie self hosted)
and I was pleased to see it does.

~~~
spraak
Yep, I was looking for that too!

------
macintux
IIRC I got bogged down early with the regular expression for parsing, but I
definitely want to try again. Really enjoyed the MAL talk at Midwest.io:
[https://youtu.be/lgyOAiRtZGw](https://youtu.be/lgyOAiRtZGw)

------
rs86
Funny there is no prolog port!

~~~
pvinis
I saw the same thing. I also found
[https://www.metalevel.at/lisprolog](https://www.metalevel.at/lisprolog) and
maybe in some free time, like, the summer, try to do the mal.

~~~
pvinis
There is also this
[https://github.com/kanaka/mal/pull/187](https://github.com/kanaka/mal/pull/187)

------
kureikain
This repos should be on developer code to read. I used it as a way to see how
people implement a LISP. Having a reference for all languages allow me to know
strong/weak point of each of them.

------
ky738
I wanna know which language port has the fewer lines of code.

~~~
hvnsweeting
Used my python package
dwc([https://github.com/hvnsweeting/dwc](https://github.com/hvnsweeting/dwc))

    
    
      dwc */ | sort -n | head
        494: examples/
        846: docs/
       1268: mal/
       1464: perl6/
       1483: coffee/
       1509: io/
       1534: racket/
       1571: ocaml/
       1579: es6/
       1621: factor/
    
    

_Edit1: for better command_

 _Edit2: for formatting_

~~~
kanaka
The problem with that command is that it also counts the Makefile, Dockerfile
and other supporting files. It also counts every implementation step (so lots
of repeats in the LOC). However, each implementation does have a "stats" rule.
So the following command at the top-level can be used to a get a nice summary:

    
    
        for i in $(make print-IMPLS); do \
          s=$(make stats^$i | grep total); \
          printf "%-9s %s\n" "$i" "$s"; \
        done | sort -n -k2
    
    

I made a gist with the current results:
[https://gist.github.com/kanaka/fdef20f5d0c2e04b97d9106b2f2f2...](https://gist.github.com/kanaka/fdef20f5d0c2e04b97d9106b2f2f23d0)

------
faragon
Brainfuck port, anyone?

[https://en.wikipedia.org/wiki/Brainfuck](https://en.wikipedia.org/wiki/Brainfuck)

~~~
rileyphone
A madman has already done it:

[https://github.com/shinh/bflisp](https://github.com/shinh/bflisp)

~~~
nathancahill
He actually did it the absolute madman

------
jlarocco
I know this is a demonstration project, but in general I wish people would
stop building new Lisps and just use one of the existing ones.

Common Lisp, Racket, Clojure, Scheme, etc. are all great choices with decent
compilers, interpreters, library ecosystems, editor support, etc.

Seems there's a new pet project Lisp released once a month or so, and none of
them add anything interesting over the existing options.

~~~
AnimalMuppet
I think that the point of building a Lisp is the process of building Lisp, not
to produce a better Lisp (or even one that is just as good).

~~~
jlarocco
I was talking specifically about the projects that get posted on HN acting as
if they're the next big thing in the Lisp world. They inevitably go nowhere
and make little impact.

Building a Lisp is a great exercise, but I don't need to know every time
somebody does it. We might as well have posts about everybody's fizzbuzz...

~~~
stcredzero
wwww.everybodysfizzbuzz.com?

