In the Visual Studio 2005 SDK Version 3, we’ve included a toolset which should be of value to you if you’ve ever considered integrating a language into Visual Studio using C#.
In the past, if you wanted to do this it was up to you to “wire-up” your lexer and parser to the Visual Studio language service interfaces or the MPF classes (Microsoft.VisualStudio.Package.LanguageService). Starting with this SDK, we’re including tools that will allow you to do this in a much easier fashion.
The tools we’re including are called MPPG & MPLex (which stand for Managed Package Parser Generator and Managed Package Lexer). They are derivative works from the open-source GPPG/GPLex tools developed at the Queensland University of Technology. In fact, the MP* versions of the tools were also developed by Dr. Wayne Kelly and Prof. John Gough at QUT and share a very similar code base.
Also, Professor Gough was at the Microsoft Campus a few weeks ago at the Lang.NET symposium. I was fortunate enough to chat with him in person for a few minutes, but the Port 25 folks did a two part interview where he talks about compilers, virtual machines, and work on Ruby .NET (a version of Ruby which compiles to IL)
I gave a short presentation on these tools at the DevLab, and included the following graphic which should make things a bit clearer:
While not a perfect representation, this should give you a basic idea of how things work together. When you provide a lex/yacc style grammar, the MPPG and MPLex tools will produce a C# lexer & parser for you at build time. These make use of a set of classes we are calling “Managed Babel” which in turn provide your language features to Visual Studio via the MPF.
Samples & Getting Started
In the Visual Studio 2005 SDK Version 3.0, there is one sample which uses these tools called Example.ManagedMyC. It supports the following language service features:
- Error Checking
- Syntax Highlighting (Colorizing)
- Brace Matching
We might include another sample showing off more features in a future version of the Visual Studio SDK.