[antlr-interest] ASTLabelType C# Problem

DJB MASTER DJBall05 at hotmail.co.uk
Sun Jul 10 01:54:53 PDT 2011


Hi, I'm using the vector math grammar example from the language patterns book
to practise with ASTs. The grammar is this one >
media.pragprog.com/titles/tpdsl/code/IR/Vec/VecMathAST.g.

I'm trying to let ANTLR build my custom nodes rather than CommonToken, so I
set ASTLabelType accordingly...

options 
{
  language = CSharp3;
  output = AST;
  ASTLabelType = ASTNode;
}

...but then I get the following compile errors on every rule... E.g, the
statement rule...

'MyParser.statement_return' does not implement interface member
'Antlr.Runtime.IAstRuleReturnScope.Tree'. 

'MyParser.statement_return.Tree' cannot implement
'Antlr.Runtime.IAstRuleReturnScope.Tree' because it does not have the
matching return
type of 'object'.

My ASTNode class is fine. I think this is more of a case of ANTLR not
generating the code properly as all the errors are in the parser. Everything
works fine just using CommonTree.

--
View this message in context: http://antlr.1301665.n2.nabble.com/ASTLabelType-C-Problem-tp6567453p6567453.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list