How to create a new language for use in Visual Studio

I would take a look at another language that has already done the legwork of integrating with Visual Studio. A great example is Boo. The language and Visual Studio integration are open source. So you can take a look at exactly what they had to do.

  • Boo Language: https://github.com/boo/boo-lang
  • Boo Syntax Highlighting for VS2010 (VSX add-in): http://vs2010boo.codeplex.com/
  • Boo Language Studio (syntax highlighting for VS2008): http://boolangstudio.codeplex.com/

The Boo Syntax Highlighting for VS2010 includes some recommended links on its homepage, which I'll copy for easy reference:

  • Nice article about "classification" (syntax highligting) in VS 2010: http://dotneteers.net/blogs/divedeeper/archive/2008/11/04/LearnVSXNowPart38.aspx
  • Examples for VSX add-ins: http://blogs.msdn.com/vsxteam/archive/2009/06/17/new-editor-samples-for-visual-studio-2010-beta-1.aspx

Regarding the Visual Studio aspects, what you need is a "language service", which is the entity that handles colorizing, intellisense, etc. for a given file extension/type.

For an intro, see this article
And for a code sample see here

Regarding parsing, there are lots of technologies, and I won't offer an opinion/advice.

Beware, there is a fair amount of work involved, although in my opinion it is much more straightforward in VS2010 than in previous versions of Visual Studio to provide this kind of extension.

See also

Visual Studio 2010 Extensibility, MPF and language services


I wrote a VS Language Service using this article as my basis: http://www.codeproject.com/KB/recipes/VSLanguageService.aspx

It wasn't too bad if you have a basic handle on Grammars.