Sam Harwell writes:
> Hi Franklin,
> 
> You didn't say exactly what the bug was. That said, here's my feedback,
> lots of it just my opinion not rules:
> 
> * Replace your call to {skip();} with {$channel = HIDDEN;}
> * Replace ^(PHO[i, "pho"] $i) with just PHO[i, "pho"]. When you
> construct the PHO token from i, it takes on the text and the token
> start/stop positions of i, so the child node is redundant.

For the record, this was a orders-of-magnitude stripped down version
of my actual program, in which I create a huge PHO tree, hence my
introduction of the dummy node; also, depContent creates other kinds
of trees, depending on conditions, other than PHO.

> * In your @after blocks, if you reference a parameter like it, you
> should use $it instead of just it.

Thanks, I am making this correction everywhere relevant.

> * I think TIER[c.tree.getToken(), "TIER"] should be
> TIER[$c.tree.getToken(), "TIER"]

Yes, you are right.

> * I'm pretty sure mainTier can initialize the wordList like this:
> mainTier returns [ArrayList<CommonTree> wordList = new
> ArrayList<CommonTree>()] and then leave out the @init block.

Yes.

> * When you're using a tree parser, try to move as much logic as possible
> to the tree parser instead of the parser. If possible, you should shoot
> for having a parser with no actions, parameters, or @init{} @after{}
> blocks (obviously this is not always possible). If you meet this goal,
> then your parser will work with any target without any changes.

The problem is that I need to do a lot of tree restructuring before I
arrive at a canonical AST that is used by many different tools.  I can
think of no better place to do it than in the parser.  In this
specific toy example, the restructuring involved is taking two lines
of text with various directives within them and then merging them
"word" by "word" like a zipper.

-- 
Franklin

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

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to