msgbartop
A site for my programming pet projects
msgbarbottom

20 Mar 09 Coco/R plugin for Visual Studio

I’ve blogged before about the excellent Coco/R parser generator. I’m using it a lot in my masters project and I’m happy with it but there were a few things I wished worked differently. The main thing was that I wanted better Visual Studio integration. I had set up a pre-build event that generated the parser and scanner before every build. However there is obviously no need to re-generate the files unless the grammar file has changed. Generating on every build also had the effect that Visual Studio kept prompting me about reloading changed files and I had to build to see if there were any errors in my grammar. So, I decided to create a Visual Studio plugin for Coco/R myself. (more…)

06 Feb 09 While Compiler for the .NET Platform

My masters project at DTU involves writing compilers for the .NET platform and since I had never written a compiler before I decided to start by writing a compiler for a simple language called While. This language is used in the Program Analysis course that is taught at DTU and has integer and boolean expressions, read and write commands, an if branching statement and a while looping statement. The compiler compiles this language and the programs can be run with the .NET CLR or Mono. The programs can also be debugged using a free graphical .NET debugger. I put the project up on Google Code, I think it is a fairly nice example of a simple compiler for .NET. It is currently written in Boo but will soon be rewritten in C#. The compiler and its source code is available at http://while-language.googlecode.com.

29 Jan 09 Coco/R for Boo

I’m currently doing my masters thesis, and as part of it I needed to implement a simple compiler for the .NET runtime, the CLR. I just recently started playing around with the Boo language, which is a statically typed .NET language with very similar syntax to Python and many of its features, while still being statically typed and offering some nice extra features such as regular expression literals and string interpolation. I wanted to try the language out on a small project so I decided to use it to write my little compiler. The only problem was that as far as I could tell there were no available parser generators for Boo. (There might well be some, I must admit I didn’t really look very hard). The only parser generator I’m used to using is Coco/R, which is nice and simple to use, and available for many languages, although not for Boo. It is however available for C# so I decided to modify it myself to make it output Boo code.

(more…)