
Learn C and build your own Lisp - juliangamble
http://www.buildyourownlisp.com/
======
falcolas
On the topic of writing lisps, an obligatory link to my favorite project: Make
a Lisp

[https://github.com/kanaka/mal](https://github.com/kanaka/mal)

~~~
jolux
not yet in brainfuck though, I see

~~~
junke
You mean, like
[https://code.google.com/p/zozotez/](https://code.google.com/p/zozotez/)?

~~~
jolux
Yes, like that.

------
uniclaude
Now might be a little late to comment, but if you want to write your own
Scheme and learn Haskell, try this:
[https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_...](https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours)

This tutorial/book, written by Jonathan Tang is actually cited as an
inspiration in the credits page and is a very nice way to get into functional
programming.

------
e19293001
There is a previous discussion about this.

[https://news.ycombinator.com/item?id=7530427](https://news.ycombinator.com/item?id=7530427)

------
segmondy
if you really want to learn to build lisp, please lookup "lisp in small
pieces" [http://www.amazon.com/Lisp-Small-Pieces-Christian-
Queinnec/d...](http://www.amazon.com/Lisp-Small-Pieces-Christian-
Queinnec/dp/0521545668)

~~~
runevault
I still remember when Amazon CA accidentally had this on sale for a pittance,
then axed all the orders when people tried to buy it. Really should get a copy
at some point.

~~~
agumonkey
Ha, they did cancel the orders ?

The fun of seeing a lisp book on amazon's best sellers all of a sudden.

ps: Highly valuable book, it's dense, theoretical but not too much, opens on a
lot of other papers, and covers a large space about languages.

~~~
Zuider
Yeah they cancelled my order. The price (of a few cents) had been assigned by
a software error. Amazon was most apologetic for their inability to ship the
item, and compensated me with a $10.00 voucher.

On a related note, I found a copy of Adele Goldberg's 'Smalltalk 80: The
Language' in a junk shop for 50 cents. When I checked Amazon, the listed price
was over five thousand dollars (due to automated bidding bots from rival
booksellers).

------
tehmillhouse
_ahem_... "Any sufficiently complicated C or Fortran program contains an ad
hoc, informally-specified, bug-ridden, slow implementation of half of Common
Lisp."

~~~
i336_
That... actually makes sense.

Sadly :(

------
bwldrbst
I learned Go and built my own Logo:
[https://github.com/adkennan/logo](https://github.com/adkennan/logo) :]

~~~
voltagex_
Are there any guides like this one for building a logo interpreter? I'd wager
it's been around 15 years since I last played with that - but it left me with
a lasting impression

~~~
bwldrbst
To be honest, I just grabbed a PDF of the Apple Logo II manual and blazed away
at it, hence the scariness of some of the eval and rendering code... I got
distracted by other things before completing the IO and editing parts but it
was a lot of fun.

------
szastupov
And so I did in 2008-2009
[https://github.com/szastupov/lgears](https://github.com/szastupov/lgears) :)

------
analog31
In a similar vein, I've been playing with a simple Lisp interpreter:

[http://www.sonoma.edu/users/l/luvisi/sl3.c](http://www.sonoma.edu/users/l/luvisi/sl3.c)

The "toy" interpreters that I've found -- Lisp and otherwise -- leak memory.
So I'm doing a little bit of research into garbage collection. All in the name
of fun and learning.

~~~
e19293001
The book refers to a link to getting started in creating a garbage collector.

[http://journal.stuffwithstuff.com/2013/12/08/babys-first-
gar...](http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-
collector/)

~~~
analog31
Thanks for that link! It looks like something that I could comprehend. My C
programming skills are pretty limited -- I learned C to move myself one step
away from assembly language on microcontrollers.

------
Zuider
Similar: Exploring Programming Languages In Perl by Bill Hails, where he
builds an implementation of Scheme

[http://billhails.net/Book/](http://billhails.net/Book/)

------
kazinator
Ah, nice topic. Just released TXR 121. TXR Lisp gets delimited continuations
in this release.

[http://www.kylheku.com/cgit/txr](http://www.kylheku.com/cgit/txr)

Doc: [http://www.nongnu.org/txr/txr-
manpage.html#N-01C4E6B4](http://www.nongnu.org/txr/txr-
manpage.html#N-01C4E6B4)

------
personjerry
Check out UC Berkeley's introductory CS class's take on it:
[http://cs61a.org/lab/lab09/](http://cs61a.org/lab/lab09/)

~~~
jeffwass
Cool. I really like the inline quizzes on that page, where you can hit the
button to toggle solutions.

------
delish
Here's another option for building a lisp-descendant from Scheme.

[http://t3x.org/s9book/index.html](http://t3x.org/s9book/index.html)

"Scheme9 from Empty Space"

I've not tried any of these. I'd be interested in someone who's done the lot
(Lisp in Small Pieces, the Haskell one, and these two C-created lisps) giving
a take on each. Making a lisp or forth seems like a great way to learn [x]
thing.

------
Wonnk13
Is this really for someone with no C knowledge, i'd definitely love to learn
manual memory management and the such - this might be too much to chew at
once.

~~~
oneeyedpigeon
Judging by the start (especially
[http://www.buildyourownlisp.com/chapter2_installation](http://www.buildyourownlisp.com/chapter2_installation))
I would say it's very much aimed at beginners. Not beginners to _programming_
but definitely beginners and up for C.

------
nils-m-holm
Shameless plug, but here we go: [http://t3x.org/s9book](http://t3x.org/s9book)

~~~
rlonstein
Nice to see you chiming in. I picked up the 2nd Ed years ago and filled in a
few of those "Oh, that's what they meant" gaps that looking at a
complete/optimized/bummed implementation didn't explain for me. :)

~~~
nils-m-holm
Good to hear! Thanks!

------
sacado2
Building a C compiler in Lisp can be a fun thing, too, and learn a lot about
C.

------
sotojuan
This looks great. C was my first language but I never did anything too
advanced with it.

~~~
type_slowly
My first love too. I still like to go back and play around with it.

------
HeadlessChild
I just started this. :)

------
autoreleasepool
Great book, but this is the third time this has been posted in the last year.

[https://news.ycombinator.com/from?site=buildyourownlisp.com](https://news.ycombinator.com/from?site=buildyourownlisp.com)

~~~
nanoojaboo
what other built-in ways are there to query stories posted to HN?

~~~
striking
There aren't any, that one is new. You can play with the Firebase or Algolia
systems though.

------
Ch_livecodingtv
I'm a bit looking too forward. Found video of Stephen Wolfram himself
demonstrating the power of his language.
[https://www.livecoding.tv/video/live-with-stephen-
wolfram/](https://www.livecoding.tv/video/live-with-stephen-wolfram/)

~~~
dang
Please stop using HN comments just to promote links to your site. Users here
consider that spam.

HN threads are supposed to be conversations. It's fine to bring up what you're
working on if it's naturally related and makes the conversation more
interesting. But it's not fine _only_ to do that, or to contrive opportunities
for it; that's not conversation, it's commercials.

------
jlg23
> If you're looking to learn C, or you've ever wondered how to build your own
> programming language, this is the book for you. In just a few lines of code,
> I'll teach you how to use C, and together, we'll start building your very
> own language.

Agreed on "a few lines", but why should I buy a whole book on this? I'd really
appreciate if the OP tried not to hijack hacker feeds for promotion. At least
in my book, (s)he is blacklisted for eternity.

~~~
wetmore
You can read the book online. Beyond that, if by hacker feeds you're referring
to hacker news, you may notice that the author of the book and the submitter
are two different people. Finally, do you really think it's unusual for
someone to use hacker news for promotion?

Save the "blacklisted for eternity" melodrama for a worthy cause.

