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

Eamon Nerbonne eamon at nerbonne.org
Wed Apr 9 12:42:43 PDT 2008


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/64d078a0/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ModalFormulaTree.g
Type: application/octet-stream
Size: 811 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080409/64d078a0/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ModalFormulaParser.g
Type: application/octet-stream
Size: 939 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080409/64d078a0/attachment-0001.obj 


More information about the antlr-interest mailing list