Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To specify that the ANTLR tool should generate C# code (rather than the default of generating Java code) for a grammar, set the grammar-level option named language to the value CSharp2 (for ANTLR 3.1+) as shown below:

Code Block
grammar MyGrammar;

options
{
    language=CSharp2;
}

// rest of grammar follows
....

Older ANTLR versions support only CSharp.

Specifying the namespace for your recognizer

...