Background
I wanted to produce a working DLR language. For this purpose I wanted to use C# Compiler tools to generate lexical analyzer and parser. I spent couple of hours tackling DLR with VS and debugger and finaly made it. There are several problems which you have to solve. First, implement a set of classes to host a your language (See Part 1), manage variables (See Part 2) and finaly produce a AST generator.
When almost everything was ready I have suprisingly strange problem with running loops and conditions. The following AST haven’t run as expected:
In fact, it does not produce any results… And again debugger had helped me. Everything was because of the following implementation of LanguageContext from DLR:

You have to override this function in your custom language context to make Conditions work:

Another, issue which blocks me for a while was Variables. I have implemented the following variable management through Variable Dictionary:

The limitation of the following solution is that it only works with Integer variables.
Solution
I have used C# Compiler Tools by Malcolm Crowe to produce Parser and Lexical Analyzer. The syntax of the grammar is similar to that of Yacc:
MyStatement: …
| ‘if’ Condition:c MyStatement:s {$$ = Ast.IfThen((Expression)c.yylval, (Statement)s.yylval);}
…
The complete grammar of the language and build tools may be found in the “Grammar and Lexer” folder of the solution.
The example of the MyL code:

The AST produced by the Parser has the following DLR Dump:

You may download DLR MyL by the following
link
See also