Live data from Hacker News

How I wrote a self-hosting C compiler in 40 days

sigbus.info

1–10 of 128 posts

Re: How I wrote a self-hosting C compiler in 40 days

#3
Thought this was going to be an inspiration to me to continue with my pet project of writing my own little programming language. But it starts off on day 8 with him already having written a basic compiler, with no explanation of how he did any of the basics. Still interesting, just not what I thought it was.

Re: How I wrote a self-hosting C compiler in 40 days

#4
I was a little surprised that the author was able to manage both C11 and the preprocessor in that time. The preprocessor is hard. But there was existing code from a previous version of it, which makes sense. Still, a fantastic achievement! Congrats to the author!

Re: How I wrote a self-hosting C compiler in 40 days

#5
post #3

Thought this was going to be an inspiration to me to continue with my pet project of writing my own little programming language. But it starts off on day 8 with him already having written a basic compiler, with no explanation of how he did any of the basics. Still interesting, just not what I thought it was.

Luckily you can see the history on Git.

Re: How I wrote a self-hosting C compiler in 40 days

#6
post #3

Thought this was going to be an inspiration to me to continue with my pet project of writing my own little programming language. But it starts off on day 8 with him already having written a basic compiler, with no explanation of how he did any of the basics. Still interesting, just not what I thought it was.

Luckily you can see the history on Git.

Re: How I wrote a self-hosting C compiler in 40 days

#8
post #3

Thought this was going to be an inspiration to me to continue with my pet project of writing my own little programming language. But it starts off on day 8 with him already having written a basic compiler, with no explanation of how he did any of the basics. Still interesting, just not what I thought it was.

Same here. I have been trying the same project as you... and get stuck on the grammar, every.single.time.

Are you done with that part yet?

Re: How I wrote a self-hosting C compiler in 40 days

#9
post #3

Thought this was going to be an inspiration to me to continue with my pet project of writing my own little programming language. But it starts off on day 8 with him already having written a basic compiler, with no explanation of how he did any of the basics. Still interesting, just not what I thought it was.

I think the best inspiration to take here is that the best way to write a compiler in 40 days is to first write one in 400 days.

From the first entry:

> Implementing these features is easy because this is the second time for me.

Re: How I wrote a self-hosting C compiler in 40 days

#10
Interesting, and quite funny to read with a sense of humour that reminds me of the movie PI. The author of the compiler goes from rational to something more... spiritual.

"Day 52

I was looking for a mysterious bug for three days: ..."

http://www.imdb.com/title/tt0138704/

Post reply on HN