August 2009 Entries
I’ve written about migrating from subversion to a DVCS a while ago, and I picked Mercurial as the flavour of the month. However, even though I like Mercurial (I use a private bitbucket plan for my own projects), a lot of the high profile open-source .NET projects use Git, Github in particular. Because that’s one of the aims for this series, I’ll be switching over to Git as my subject. One of the first articles I’ll post is a small write-up on how to migrate your Mercurial/Subversion repositories to Git. Stay tuned!
ANTLR generates code, which you have to assume works as it should. However, the output is a variable factor, determined only by your grammar files. Considering that the rest of the application, or at least the part which loads the AST into your object model, depends on a specific output from your parser, it’s smart to test your parser output. Consider the following grammar: grammar expression;
options {
output=AST;
ASTLabelType=CommonTree;
}
expression : additiveExpression*;
additiveExpression : value ('+' value)* -> ^('+' value+);
value : NUMERIC;
NUMERIC : '0'..'9'+;
This grammar accepts input in the form of x+y, where x is an integer value. Thanks to the rewrite rule...
After my previous post I’ve had some feedback and help (thanks @Tigraine!), which led me to ask myself the next question. Why not simply host the ruby code in a IronRuby container, calling the ruby code directly? This would, indeed, make my life a lot easier. However, seeing my third point, I think it’s a valid reason to keep going down the path I’m on right now: “Third, and perhaps the most important reason: I want to learn. Parsing CSS is a nice way to learn how to parse a DSL using Antlr, something I wanted...
I’ve been hesitant on publishing this, because I’m never happy with the code I write. As it happens, I have the same problem with writing articles for my blog as well (some people tell me I simply try too hard…). Anyway, without further delay, I present to you my latest pet project: Less.NET! What is Less.NET? Less.NET is a C# port of the LessCSS ruby gem. I have been using LessCSS in a few test projects, and I am really happy with the way it structures my CSS files (see http://www.lesscss.org for more info). Why port...