[antlr-interest] tree grammar namespace option for CSharp target

Jim Idle jimi at temporal-wave.com
Wed Apr 9 13:06:32 PDT 2008


I should clarify:

 

@namespace { } 

 

Is what it should be I think.

 

Jim

 

From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: Wednesday, April 09, 2008 1:04 PM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] tree grammar namespace option for CSharp target

 

Don't remove the tree part, but do remove the @parser:: part and you should find that it works :-)

 

Jim

 

From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Eamon Nerbonne
Sent: Wednesday, April 09, 2008 12:43 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] tree grammar namespace option for CSharp target

 

Using C# + ANTLR 3.0.1 (antlrworks 1.1.7), I'd like to place the generated tree grammar parser in a namespace.  The wiki-docs explain how to do this for parsers and lexers, but these commands don't work in tree grammars.

The antlr wiki-docs are at http://www.antlr.org/wiki/display/ANTLR3/Antlr+3+CSharp+Target#Antlr3CSharpTarget-Specifyingthenamespaceforyourrecognizer
The (simple) grammar which triggers this is attached, but the problematic combination is simply:

tree grammar ModalFormulaTree;

options { 
    language=CSharp;
    tokenVocab=ModalFormulaParser;
}

@parser::namespace { FormulaParser.Generated }
 
Notably, removing the "tree" from the first line still generates a tree grammar and no longer complains about an "unknown or invalid action scope for tree grammar: parser", but the resultant tree grammar is not placed in a namespace tag.

Is there a different option for tree grammars - or is this a bug?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080409/19f38e6a/attachment.html 


More information about the antlr-interest mailing list