[antlr-interest] Confusion about the AST that ANTLRworks 1.3.1 displays during a debugger session
Bob Anderson
bob.anderson at centurytel.net
Mon Dec 14 21:18:47 PST 2009
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/20091214/3e85c773/attachment.html
More information about the antlr-interest
mailing list