Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

ANTLR v3 C# Code generator and Runtime library

Kunle Odutola
kunle UNDERSCORE odutola AT hotmail.com

Micheal Jordan

Status

As of April 2007, the C# code generator and runtime are compatible with ANTLR v3.0b8. They should be integrated into the depot (and hence appear on the daily builds) soon. As before, development proceeds sporadically due to other commitments.

The code generation templates and the runtime library itself are essentially feature complete with respect to the reference Java version. The C# (and Python) targets have a definite advantage due to the existence of a native StringTemplate implementation. There are still currently zero automated tests written and there hasn't been much time to investigate how such tests can/should be written (we suspect this applies to all the other targets too). In any case, some basic sanity check are done with samples grammars in the examples-v3 archive.

UPDATE: Some of the other targets apparently have some automated unit tests already. Hopefully this can suggest an approach that is applicable to the C# target too.

Architecture

As with all other targets, the C# code generation and runtime are modelled on the Java version. This means the C# target supports features such as grammar development/prototyping and remote debugging with the AntlrWorks GUI which is very important for ANTLR users. Developing radically different code output is left as an exercise to the reader (wink)

Target Platforms

Microsoft .NET v1.1 and v2.0
Mono

Supported build tools

Microsoft Visual Studio 2003 and 2005
Nant v0.85

Performance

The V3 target generates code that is easily faster than that generated by the V2 target (especially the lexers). We probably won't be able to match the bare-metal performance of the code generated by Jim Idle's C target or Ric Klaren's C++ target but, we expect to be very competitive with the other targets.

Running

For generating C# code set "language=CSharp;" in the options block of your grammars.

  • No labels