dcsimg
The generated CPP code is not correct when constructing a heterogenous AST tree.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Huang_ChuanDong
Posted On:   Wednesday, November 19, 2003 11:08 PM

// PLUSNode.hpp class PLUSNode : public antlr::CommonAST..... typedef antlr::ASTRefCount RefPLUSNode; // ................... supposing that we have the following grammar: // calc.g class CalcParser extends Parser; options { buildAST = true; } tokens { PLUS ; INT; SEMI; } expr : mexpr (op:PLUS^ mexpr)* SEMI! ; ................ the CPP code generated by ANTLR2.7.2 for the rule ""expr"": .............. PLUSNode op_AST = static_cast (antlr::nullAST); ..............    More>>

// PLUSNode.hpp


class PLUSNode : public antlr::CommonAST.....


typedef antlr::ASTRefCount RefPLUSNode;


// ...................



supposing that we have the following grammar:



// calc.g


			
class CalcParser extends Parser;
options
{
buildAST = true;
}
tokens {
PLUS ;
INT;
SEMI;
}
expr
: mexpr (op:PLUS^ mexpr)* SEMI!
;
................

the CPP code generated by ANTLR2.7.2 for the rule ""expr"":



..............


PLUSNode op_AST = static_cast (antlr::nullAST);
..............



But we can't convert from RefPLUSNode to PLUSNode.


How to deal with the problem?

   <<Less
About | Sitemap | Contact