Handmade Hero»Forums»Code
Stefan Koch
22 posts
HandMade Compiler
Edited by Stefan Koch on
I just watched yesterdays stream.
casey mentions that he does not want to introduce to much language complexity because it makes it harder to write compilers for the game.
Actually I am building my own "Hand-made Compiler" right now.
Simple templates like min, max or swap are okay. But if you go gung-ho with templates it gets hard to compile efficiently.

@casey I will write a C+X compiler where the X is whatever you would like (assuming I can implement it.)

Would you guys here want to watch a C compiler being written form scratch ?
Stefan Koch
22 posts
HandMade Compiler
Of course without the use of lex or yacc!

Just like HandmadeHero. Everything with explanation and almost no previous knowledge required.

If you like to sneak preview the code it's on github
www.github.com/UplinkCoder/qcc.
Everything but my optimization passes will be open-source.
Christopher O Connor
7 posts
HandMade Compiler
Hi, I would like to see that.
Johan Öfverstedt
45 posts
HandMade Compiler
I would absolutely want to see that happen! I would never miss a show!
Livet Ersomen Strøm
163 posts
HandMade Compiler
I already follow the videos of Jonathan Blow. And they are very interesting. (And I missing more frequent updates....:)

I am new to this kind of "infotainment", and I like it. To view Jon Blow or Casey code, is just fucking beautiful.

However, it's not the fact that he (JB) is writing a compiler that interest me the most, but the mindset, and philosophy he has for doing so. Which seem to me very close to the right thing.

I also think that writing a truely NEW compiler, is almost a neglected area, where the opportunities for doing something truely unique and magnificent is rather big. However, I fear that in the marketplace, that's sadly not always enough.
Johan Öfverstedt
45 posts
HandMade Compiler
Kladdehelvete
I already follow the videos of Jonathan Blow. And they are very interesting. (And I missing more frequent updates....:)

I am new to this kind of "infotainment", and I like it. To view Jon Blow or Casey code, is just fucking beautiful.

However, it's not the fact that he (JB) is writing a compiler that interest me the most, but the mindset, and philosophy he has for doing so. Which seem to me very close to the right thing.

I also think that writing a truely NEW compiler, is almost a neglected area, where the opportunities for doing something truely unique and magnificent is rather big. However, I fear that in the marketplace, that's sadly not always enough.


Yes it's great in many many ways. You learn new ways of thinking about code when you hear their train of though while you see the code manifest itself.

JB has inspired me to design a new language domain-specific for realtime audio/DSP-applications. I have struggled with applying C++ to this field for a long time now but either you give up performance or code quality (template hell, macro cesspool or lots of code repetition). I also see lots of potential for new languages, and as long as I benefit from the new language that's reward enough. The marketplace is always a strange ultra conservative place so it's hard to design a language to please the current marketplace fixated on web 2.0 without making a JavaScript-clone with extra bloat on top.
Stefan Koch
22 posts
HandMade Compiler
Edited by Stefan Koch on
Well, then.
Lets go an make a compiler everybody can understand ;)

I cannot say anything about frequency of uploads yet.

I will be loading up a video to youtube on monday.
Johan Öfverstedt
45 posts
HandMade Compiler
UplinkCoder
Well, then.
Lets go an make a compiler a everybody can understand ;)

I cannot say anything about frequency of uploads yet.

I will be loading up a video to youtube on monday.


Are you going to live-stream or post after the fact on YouTube? Dynamic or Static typing :P Either way I am all over this.
29 posts
HandMade Compiler
A recommended book on the topic:

https://sites.google.com/site/lccretargetablecompiler/

This is *not* a theoretical book (like the "Dragon Book", which you'll see referenced often if you look into the topic). To think of it, it feels a lot like Handmade Hero, except in book form, in that it shows real code and uses that to explain the underlying principles.

The whole source code is available here:
https://github.com/drh/lcc/tree/v3_6

The newest version (which is not described by the book) lives here:
https://github.com/drh/lcc

Good luck with your endeavour!
Stefan Koch
22 posts
HandMade Compiler
Edited by Stefan Koch on
Removed the links to the videos

I will do proper videos later :)
Awais Ahmad
11 posts
HandMade Compiler
Oh I would so love to watch that. Right now I am a little behind on Caseys video series so I need to catch up. When I am all caught up I will start watching your videos as well(hopefully) as long as they are not too long. Its so amazing to see people who are willing to take time out of their lives to help inexperienced users. Keep up the good work!
Johan Öfverstedt
45 posts
HandMade Compiler
I would love to watch this series unfold. Too bad about the cold in the first videos, these are troubled times :) I have never done any work in D lang so it would be interesting to see that in action too. Very cool stuff.
Stefan Koch
22 posts
HandMade Compiler
Thanks for watching!

I'd like to hear a bit of constructive criticism.

Regards, Stefan
Johan Öfverstedt
45 posts
HandMade Compiler
I will rewatch the videos later tonight and produce a more detailed review. One thing that immediately comes to mind is a silly detail such as the language of the IDE. Running VS in English would simplify the ability for someone who is not that well versed in the German language to follow what you are doing. :)
Stefan Koch
22 posts
HandMade Compiler
Edited by Stefan Koch on
sorry no twitch stream. I am too sick today.