
Writing a Lisp to x86-64 compiler - tekknolagi
I&#x27;m starting to write a series on compiling Lisp to x86-64 and I would appreciate any and all feedback.<p>Find the first post at https:&#x2F;&#x2F;bernsteinbear.com&#x2F;blog&#x2F;compiling-a-lisp-0&#x2F;
======
tekknolagi
Clickable link: [https://bernsteinbear.com/blog/compiling-a-
lisp-0/](https://bernsteinbear.com/blog/compiling-a-lisp-0/)

------
tempodox
This first post is nicely done. The basics of building a JIT compiler in just
a few lines of C, and everything thoroughly explained.

Also, the “getting your hands dirty” and “making your own mistakes” approach
is how you really learn something.

~~~
tekknolagi
Just finished the second post this morning if you're interested:
[https://bernsteinbear.com/blog/compiling-a-
lisp-2/](https://bernsteinbear.com/blog/compiling-a-lisp-2/)

------
rightbyte
The raw concept of executing modified memory is neat. It looks so clean and
simple.

------
z3phyr
This is something I was looking forward to! Thanks you so much <3

Do you follow John Carmack's coding standard?

~~~
tekknolagi
Just finished the second post this morning if you're interested:
[https://bernsteinbear.com/blog/compiling-a-
lisp-2/](https://bernsteinbear.com/blog/compiling-a-lisp-2/)

------
scott31
Why not Arc to x86-64 compiler?

~~~
tekknolagi
I don't know anything about Arc. I also want a bit of creative license to
change the host language as needed, and people might not appreciate "Arc with
Max's edits".

------
jart
You're missing the forest for the trees. What's the tiniest x86-64 code
generator that can bootstrap John McCarthy's meta-circular evaluator, as it is
written in his original paper. Now that's something I'd love to see. What he
accomplished there is so profound and has served as the center of gravity
that's attracted folks to LISP ever since. Also if you build it with APE your
distributables will run on all platforms
[https://justine.storage.googleapis.com/ape.html](https://justine.storage.googleapis.com/ape.html)

~~~
nils-m-holm
> What's the tiniest x86-64 code generator that can bootstrap John McCarthy's
> meta-circular evaluator, as it is written in his original paper. Now that's
> something I'd love to see.

If a C code generator will do, this will be the topic of my upcoming book.

~~~
jart
Wow I'm not sure if I've ever influenced someone to write a book before.
That's certainly something I'd pay to read. Can we call it "The LISP
Challenge"?
[https://twitter.com/JustineTunney/status/971235177002225665/...](https://twitter.com/JustineTunney/status/971235177002225665/photo/1)
I think C code generation is great. The problem generalizes well across
languages, which is why I love suggesting it to my friends who are getting
into the latest one: take The LISP Challenge!

~~~
nils-m-holm
> Wow I'm not sure if I've ever influenced someone to write a book before.

I hope I am not disappointing you too much, but the book was already in
progress when you posted your message! Coincidence! :) And the title is pretty
much set at this point, I'm afraid...

