[antlr-interest] Confusion about the AST that ANTLRworks 1.3.1 displays during a debugger session
Jim Idle
jimi at temporal-wave.com
Tue Dec 15 13:37:32 PST 2009
You are probably looking at the parse tree and not the AST.
Jim
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Bob Anderson
Sent: Monday, December 14, 2009 9:19 PM
To: antlr-interest at antlr.org
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 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091215/7233a451/attachment.html
More information about the antlr-interest
mailing list