[antlr-interest] AST node creation
Bill Andersen
andersen at ontologyworks.com
Mon Feb 18 06:37:12 PST 2008
Folks,
My apologies. The example below works - some kind of lag in Eclipse.
On Feb 18, 2008, at 09:34 , Bill Andersen wrote:
> I've been trying the example on p 170 of the ANTLR reference, with a
> small tweak. I have a tree-generating grammar ( output=AST is set }
>
> name
> : NAME
> -> { new CommonTree(new CommonToken(NAME, "Fred")) }
> | BLANK_NAME
> ;
>
> meant to convert any NAMEs seen to "Fred". When I run the parser
> and print the AST I don't see any Fred NAMEs, even though the test
> input hits this production plenty.
>
> Running the code thru the debugger shows the relevant code
>
> root_0 = (Object)adaptor.nil();
> // 102:3: ->
> {
> adaptor.addChild(root_0, new CommonTree(new CommonToken(NAME,
> "Fred")) );
> }
>
> is being executed. Am I missing anything?
>
> .bill
>
Bill Andersen (andersen at ontologyworks.com)
Ontology Works, Inc. (www.ontologyworks.com)
3600 O'Donnell Street, Suite 600
Baltimore, MD 21224
Office: 410-675-1201
Cell: 443-858-6444
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080218/8e54153b/attachment.html
More information about the antlr-interest
mailing list