2011年11月9日星期三

Microsoft Opens Up .NET Compilers


At BUILD Microsoft released the Visual Studio 11 Developer Preview but what may be coming next—after Visual Studiouggs boots for women uggs boots for women uggs boots for women 11—promises to take code generation and refactoring to meta-programming levels. Programming legend Anders Hejlsberg, a Microsoft technical fellow and the chief architect of C#, hosted a session on the future of Visual Basic and C# at BUILD and announceduggs boots for women uggs boots for women uggs boots for women an October preview of the .NET compilers as a service (codenamed the Roslyn Project), which opens up the Microsoft C# and VB compilers as public APIs. Hejlsberg first talked about the compilers as a service project at PDC 2008.

On Wednesday, Microsoft released the first CTP of the rewritten C# and Visual Basic compilers. The existing compilers are built in C++. The new compilers are rebuilt in managed code using their respective languages. (Compilers as a service are not on the roadmap for other .NET languages, according to Microsoft.) Miguel de Icaza introduced a Mono C# Compiler as a Service on Windows last April. The Mono project originally introduced the C# compiler as a service in September 2008 but only Mono users ( Linux and OSX)uggs boots for women uggs boots for women uggs boots for women could use it based on Mono-specific extensions that prevented its use on the Microsoft runtime.

The purpose of the Roslyn CTP is to get developers' feedback on the new model and public APIs, according to Microsoft. The Microsoft "Roslyn" October 2011 CTP exposes an API layer that "mirrors a traditional compiler pipeline" and offers a glimpse at planned Workspace, Services and Scripting layers. The compiler services include a Syntax Tree API, Symbol API, binding and flow analysis API and emit API. The Roslyn CTP is an extension to Visual Studio 2010 SP1 that requires Windows 7, Windows Server 2008 R2 and the Visual Studio 2010 SP1 SDK.

Head of the Microsoft Developer Division, "Soma" S. Somasegar explained the post-Visual Studio 11 technology in his blog:

With these compiler rewrites, the Roslyn compilers become services exposed for general consumption, with all of that internal compiler-discovered knowledge made available for developers and their tools to harness. The stages of the compiler for parsing, for doing semantic analysis, for binding, and for IL emitting are all exposed to developers via rich managed APIs.

The compilers as a service technology introduces language services and APIs that will have full fidelity with C# 4 and Visual Basic 10, according to Microsoft, but many of the language features did not make it into the October preview. The Interactive window for scripting, similar to F# Interactive, supports C# in the October preview. Visual Basic support is planned for a future release, according to Hejlsberg.

Some of the scenarios envisioned by Microsoft for the Roslyn technology include embedding C# code snippets in Domain Specific Languages, creating Read-Eval-Print-Loops (REPLs) for interactive programming and building third-party dev tools using the new language object models.

Microsoft is working hard on technology beyond C# 5.0 and Visual Basic 11, which are the latest versions supported in Visual Studio 11. Both languages have been updated to support more asynchronous programming (Async previews) and the new Windows Runtime (WinRT) for Metro style apps.

没有评论:

发表评论