[antlr-interest] (Newbie)Problem with importing the token type definition

ali azimi aliaazimi at yahoo.com
Mon Jul 23 18:05:37 PDT 2007


Hi,
   
  I read the following at the ANTLR book:
   
  "You do not need the imaginary token definitions in the tree grammar
  because the tokenVocab=CMinus option imports the token type definitions
  from the parser grammar, CMinus.g, via the CMinus.tokens file." (pdf Page 201 )
   
  I have followed the instructions, but my Tree walker still does not import the tokens from the parser grammar. That means My tree walker still shows red lines saying "Undefined references" if I do not include the imaginary token definitions in the tree grammar also.
   
  The followings are the options parts of the grammer and the tree walker.
   
  grammar FinalProject;
options {
backtrack=true;
language=Java;
output=AST;
  // ANTLR can handle literally any tree node type.
// For convenience, specify the Java type
ASTLabelType=CommonTree; // type of $stat.tree ref etc...
  }
   
   
   
  tree grammar FinalProjectWalker;
options {
tokenVocab=FinalProject; // reuse token types
ASTLabelType=CommonTree; // $label will have type CommonTree
}
   
  Could you please tell me what is that I keep missing?
   
  Thank you so much in advance.
   
  Best wishes,
   
  Al

       
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070723/a36e1cb8/attachment.html 


More information about the antlr-interest mailing list