Monthly Archives: March 2009

OpenCompiler project

Ever since I saw the capabilities of the Boo programming language and their eco-system, I’ve been constantly asking myself; Why don’t we have these posibilities with C#. The ability to extend the language with macros or even further to give your code more expressiveness and solve domain specific limitations to the language itself, feels to me so natural and the correct path to go down.

The concept is really not a new one, but with Boo they’ve made it more seemless and it feels more natural. C/C++ and other languages has had macros from day one, but they’ve been limited to just expand into their own context and not be able to modify anything. With Boo you get the oportunity to actually modify the entire AST tree during compilation. This is the feature I am really missing, if you wonder about why I want it, you can read this post or this.

With this as a backdrop, one sunday afternoon I found myself in front of the computer (no surprise there) and was pondering about this. I had looked at the Mono compiler for a while, to see if it was at all possible to sneak in the posibilities into that one. Then my crazy head started to think; what if I wrote my own, at least I could try – nothing to lose. So, I started looking around the net to get inspiration and to find good articles about how to write your own compiler – and I came across an article by Joel Pobar on MSDN that really inspired me and made me think it would be possible.

After a couple of weeks of working on it, on and off, I figured out it was about to take shape and maybe, just maybe, it had a chance of surviving in the jungle of projects I tend to start up (but not finish). So, today I went to Codeplex and established a project with the catchy name of OpenCompiler (probably a million projects named this already. 🙂 ) and uploaded the source thus far. You’ll find the project here.

The road ahead
So far, what the compiler is able to do is to recognize most of the C# grammar in the scanning phase of the lifecycle. This is converted to something that the parser can understand and make more sense of. The parser then builds the AST tree consisting of all the things that can be generated for the IL code. The last week I’ve been working on making the AST tree complete with regards to which elements needed.

So far, this is at a level were I am still hoping it is possible to do this. My main doubts are not with regards to wether or not it is technical possible, but will it be a project that is doable in the sense that I can spend enough time on it to actually make a version 1.0. Time will tell. I’ve decided to focus my sparetime energy these days on this project, because I think it is important – and it will ultimately make the code I write from day to day look better and more expressive.

I’ll be posting more details about the project as I work on it, to document what I’m thinking and how I want to things, hopefully I’ll get some input from the ones reading the posts to guide me in the right direction. This is the first time ever I try to write a compiler of this magnitude.

[Interviewing Scott Hanselman – the podcast expert above experts]

Developers worldwide know Scott Hanselman and his podcasts. As one of the true community heroes of the web he has posted more than 150 podcasts covering a vast array of topics. Displaying developer skills he combines relevant stuff with humor when interviewing his subjects, making his podcasts enjoyable, useful and fun to listen to. I’ve been lucky enough to catch the busy Scott for an interview. Tune in and see how it went.

It was originally recorded as a WebCast, so you'll find both the video and audio only here.

English
Download full MP3
Subscribe on iTunes
Watch on YouTube
#1
#2
#3 .
Or download full MP4 here

Video #1
[youtube http://www.youtube.com/watch?v=_gPrrAVzqSs&hl=en&fs=1]

Video #2
[youtube http://www.youtube.com/watch?v=hg_bIcx2NAI&hl=en&fs=1]

Video #3
[youtube http://www.youtube.com/watch?v=VkQeSaEs0v0&hl=en&fs=1]

Notes

The intro and the outro music created by Kim M. Jensen.

Please do not hesitate to leave any comments on this post. If you have ideas for people you'd like to get interviewed, please leave a comment or contact me through the contact page.


[Turning the table around]

This show has an interesting turn of event, my previous guest; Raymond Holmboe, asked to turn the table and lead the show by interviewing me. We talk in general about software development and processes.

Norwegian
Download full MP3
Subscribe on iTunes

Notes
The intro and the outro music created by Kim M. Jensen.
Please do not hesitate to leave any comments on this post. If you have ideas for people you'd like to get interviewed, please leave a comment or contact me through the contact page.