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 CSharp as shown below:

Code Blockpanel

grammar

MyGrammar;

options

{


{
language=CSharp;


}

//

rest

of

grammar

follows


....

Specifying the namespace for your recognizer

Namespace can be set via:You can specify that your generated recognizer should be declared within a specific namespace as ahown below. By default all recognizers are generated as top-level types with no enclosing namespace.

Code Block
@lexer::namespace {
	mynamespace.parserMy.Custom.NameSpace.For.Lexers
}

@parser::namespace {
	mynamespace.parserMy.Custom.NameSpace.For.ParsersInclTreeParsers
}



Debugging with ANTLRWorks