[antlr-interest] bugs with 2.7.6? (answer to " A problem with loading AST Node type occured")

=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?= sunjigang1965 at yahoo.com.cn
Fri Feb 10 09:08:50 PST 2006


I did a small change in method loadNodeTypeObject() in
class antlr.ASTFactory                       

I changed nodeTypeName by prefixing it with 
NAMESPACE+".". I added on statement before " 
nodeTypeObject = assem.GetType(nodeTypeName);"


 if (nodeTypeName == "INTNode") nodeTypeName =
"MiniJava." + nodeTypeName;

so nodeTypeName becomes "MiniJava.INTNode". 

I suppose antlr user should not use his own namespace
if he want use hetero AST by default.

Jigang
                       
--- "Ëï¼Í¸Õ Jigang (Robert) Sun"
<sunjigang1965 at yahoo.com.cn>дµÀ:

> ÈÕÆÚ: Tue, 7 Feb 2006 16:39:52 +0800 (CST)
> ·¢¼þÈË: 
>     "Ëï¼Í¸Õ Jigang (Robert) Sun"
> <sunjigang1965 at yahoo.com.cn>
> Ö÷Ìâ: A problem with loading AST Node type occured.
> ÊÕ¼þÈË: "antlr-interest at antlr.org"
> <antlr-interest at antlr.org>
> 
> A problem with loading AST Node type occured.
>    
>   Here is my simplest grammar:
>    
>    primaryExp
>   :
>    INTEGER_LITERAL <AST=INTNode>
>   ;
> 
>    
>   INTNode class
>    
>    public abstract class Expr : antlr.BaseAST{
>   public abstract int value();
>  }
>    
>    public class INTNode:Expr{
>   int val=0;
>   public INTNode(Token tok){
>    val=int.Parse(tok.getText());
>    }
>   public override int value(){
>    return val;
>   }
>   
>   public override  void initialize(AST t){
>   }
>   public override  void initialize(IToken t){
>   }
>   public override  void initialize(int i,string s){
>   }
>  }
>    
>   I have just newly downloaded Microsoft Framework
> 2.0, but the problem is still persisted.
>    
>   Jigang
> 
> 		
> ---------------------------------
>  ÑÅ»¢1GÃâ·ÑÓÊÏä°Ù·Ö°Ù·ÀÀ¬»øÐÅ
>  ÑÅ»¢ÖúÊÖ-ËÑË÷¡¢É±¶¾¡¢·ÀɧÈÅ  


__________________________________________________
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com


More information about the antlr-interest mailing list