You are probably looking at the parse tree and not the AST.
 
Jim
 
From: [email protected] 
[mailto:[email protected]] On Behalf Of Bob Anderson
Sent: Monday, December 14, 2009 9:19 PM
To: [email protected]
Subject: [antlr-interest] Confusion about the AST that ANTLRworks 1.3.1 
displays during a debugger session
 
I'm trying to build an AST that has extraneous tokens removed.  But whether or 
not I use a rewrite rule, ANTLRworks always shows me an AST with every token in 
it.  Is that normal ANTLRworks behavior, or am I missing some directive? 
 
Below is a snippet of the grammar...
 
options 
{ 
  language = CSharp2; // CSharp2 targets .Net 2.0  (as opposed to CSharp which 
targets .Net 1.1)
  output   = AST;
}
 
prog    : stat+ ;
 
// The following statements produce the same AST display in ANTLRworks... 
 
stat    : 'showInt'  '('  STRING ','  expr ')'  // All tokens expected to be in 
the AST
 
stat    : 'showInt'  '('  STRING ','  expr ')'  ->  ^( 'showInt'  STRING expr ) 
 // Token suppression via rewrite  
 
stat    : 'showInt'  '('! STRING ','! expr ')'! // Another way to suppress 
tokens
 
 
Input is:  showInt ( "an int: " , (67 * 98) mod 7 )


--

You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to