Wednesday, February 6, 2008

Compiler

It suddenly occurred to me (epiphany?) - while reading an MSDN article on building a compiler targeting the MS CLR - that this would be the best way to learn the nuts and bolts of the system (CLR included).

Having already designed a 32-bit non-pipelined processor and an assembler (coded in VHDL and implemented on Spartan-3 FPGA - under the able guidance of my colleague and mentor Yogendra Namjoshi) I can boast a clear understanding of assembly and conversion to native code.

So here I plan to go about jotting down the plans, progress as well as my thoughts during the entire project. I think the first step would be to plan how the project is going to be spread out; given the limited time available everyday after work and the weekends. A rough layout would be something like this:

· Initial literature survey ( a bit of language design fundamentals, scanners, parsers, code generators , compiler design walk through etc.) ·

- Getting the recipe right. This is the tough and perhaps the most crucial stage IMHO i.e. deciding what parts to lift off the shelf and what to custom build. Like for example, there are several parsers readily available(mostly coded in C#) while the scanners are hand-coded best. The compiler project can also be divided into two parts: the front and the back end. To reproduce the diagram given by Joel Pobar:



· Understanding the CLS which ensures that the "Ergo" language falls within the .NET frame.

· The language in which to code the scanner.
· A complex project like this would also do good to have some timelines ( I prefer the word time-lines to deadlines) to ensure completion.

· Finally I realize the necessity and inevitability of collaboration on a project like this, to churn out some thing useful.

1 comment:

Yogendra Namjoshi said...

Hey Praveen,

I don't know much about Microsoft Common Language Runtime, apart from knowing its full-form and its relation to .NET Framework. But, nevertheless, designing a compiler or an interpreter for any kind of system (including the simplest among them like a self-designed stack processor) is a complex task.

I would encourage you to take up some coursework or at least go through some course material targeting Data-Structures, Compiler and finally Computer Architecture. The first two being important ones - you need to go little deeper and cannot skip the theoretical "trenches". CA: You can skim through if required during the timeline.

And finally, I am surprised to see a programmer-phobic person to actually taking up something like this. My wishes... but do not procrastinate or out-source...

Yogendra