Home   Cover Cover Cover Cover

Pilot Project using the Shared Source Implementation of CLI and C#

Compiler Generation Tools for C#

See the home page of Coco/R

We plan to create a framework for various tools by
  • extending the Coco/R compiler generator to allow LL(1)-conflict resolution by using semantic information.
  • providing an attributed C# grammar template for Coco/R to facilitate source code instrumentation and analysis.

News   |   2nd Rotor Workshop   |   1st Rotor Workshop   |   Project background   |   Project Objectives   |   Applications   |   Ongoing projects


April 29, 2003

Second version of Coco/R (2.0 beta) with attributed C# grammar.

April 17, 2003

We created a project at the Rotor Community Site, where we offer downloads of up-to-date versions of Coco/R and the attributed grammar template for C#, and eventually applications developed with the these (= compiler generation tools). The sites also has some mailling lists, discussion forums and other project related stuff. Check it out at cocotools.sscli.net.

November 21, 2002

First (alpha) version of C# attributed grammar and sample application.

Second Rotor Project Workshop at Pisa

From April 23rd to April 25th, 2003, the University of Pisa held the 2nd Rotor Project Workshop
at Santa Croce di Fossabanda at Pisa, Italy. The intension of the workshop was to give the projects teams a forum for presenting and discussion their (intermediate) results. In the Compilation track we were schedule to give the talk "Compiler Generation Tools for C#", but unfortunately had to cancel the day before the presentation. You can still download the slides of the talk here:

Get the slides in PDF or PowerPoint format.

First Rotor Project Workshop at Cambridge

From July 23rd to July 26th, 2002, Microsoft held the
1st Rotor Project Workshop at Queen's College, Cambridge (UK).
Among other things the workshop offered the project teams an opportunity to communicate their Rotor-related ideas and work to each other. In that track we presented a poster and a short talk about the Coco/R compiler generator and what we intend to do with it in connection with Rotor. You can download both the posters and the slides here:

Get the posters in PDF format

Get the slides in PowerPoint format


Development of the compiler generator Coco/R originated at the University of Linz, Austria, and was then continued at ETH Zürich. At the moment it is available for Java, C/C++, Oberon, Modula-2, Pascal, Delphi and since last year C#. Coco/R is a compiler generator which in its current version takes a compiler description in the form of an attributed, context-free EBNF grammar (ATG) and generates the corresponding scanner and recursive descent parser. Coco/R require the input ATG to be LL(1), which prohibits applying it to most of the popluar programming languages such as Java, C++, ..., because these are not LL(1) and therefore require a shift-reduce parser.  
Click on the image on the right to get an overview of Coco/R (*.png image)


Since there are certain advantages to using RD-parsers, we want to extend Coco/R so that it can deal with non-LL(1) grammars by using additional semantic information. The solution we have in mind is the following:

Enable semantic annotations in the attributed grammars to distinguish between alternatives that would produce LL(1)-conflicts. This demands some changes to Coco/R which shall be implemented as one part of this project. Having this extension installed is a requirement for using Coco/R with C#, which we plan to do in the second part of the project.

For the second part of the project, we want to use the shared source implementation of the C# compiler in order to get a better understanding of how it works, and therefore be able to create an attributed C# grammar template that is fully compliant to the language definition as provided by ECMA Standard 334.


The new version of Coco/R and the attributed grammar template will form a framework that provides complete parsing facilities for C# programs. Concrete applications can be instantiated from the framework by simply inserting the necessary semantic actions into the ATG template, and letting Coco/R automatically create the scanner and parser. Such applications can be used for

Projects in the works ...

These are applications of the framework we are currently working on.

  • White-Box-Testing Tool (for path coverage!)
  • CodeDOM Parser (implementing System.CodeDom.Compilers.ICodeParser)
  • C# Code Analyzer
  • Performance Hint Tool
Last updated: April 24, 2003