[antlr-interest] Reparsing a subtree. Or another solution?

Joan Pujol joanpujol at gmail.com
Tue Nov 16 13:44:01 PST 2004


Hello,

The small question is:

How can I reparse a subtree when parsing the complete AST using a treeparser?

I need this, because, is the best form I have found to solve this problem.

I have:
expression[rvalue]:
	procedurecall(expressionlist[BitSet])
    |IDENT { Code to check if ident is initialized and other checks}
	;
	
	expressionlist[Bitset]: (expression[rvalue])+ //Each rvalue is fixed
acording a position in the BitSet.
	

The problem is that I have input,output and input/output parameters in
procedurecalls. For the output parameters I have to mark rvalue as
false. But the problem is that I can't do it because I can't determine
wich is the procedure to call until I have parsed the expressionlist
(Then I can't determine if the parameter is an output one).
And then I have though that I need to parse one time to get the types
and another to do the checks. But I want to only parse this part of
the tree.
This is the best solution? Or there is something wrong in my design?

Also I though that I have to add a parameter to expression -->
expression[rvalue,noerrors]. To set noerrors to true in the first
pass. To avoid to report the errors twice.

A lot of thanks in advance,
-- 
Joan Jesús Pujol Espinar


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list