[antlr-interest] tree recognition during multiple passes

excel_robot dermot_oneill at hotmail.com
Mon May 10 04:11:48 PDT 2004


Hi Guys,
I'm using Antlr to develop a source to source translator.
I have read a good bit of the doc and articles and they all seem to
suggest the following
1)lex your input into tokens
2)recognize the tokens in your grammar and build a source AST
3)recognize and morph your source AST to a target AST using multiple
passes
4)generate your output from the target AST

My problem lies with recognizing the entire AST during the passes, as
it is neither a pure Source AST or pure Target AST.
In the following FAQ
http://www.jguru.com/faq/view.jsp?EID=759279
Mr Zukowski mentions that you can combine 2 languages into the same tree.

My Question is how do I recognize a tree during the passes?
A solution would be that for each pass I convert a sub tree entirely
from Source AST to Target AST. I could then verify the sub tree
against the Target AST recognizer.Then this sub tree would not be
modified again by future passes.

What I could not do is half convert a sub tree in one pass and then
finish it off in another pass. The reason being I could not recognize
this sub tree after the first pass.

Am I on the right track? Or are trees recognizable when they are
neither pure Source AST or pure Target AST.

Thanks for your time.
Dermot.

PS: I have worked with javacc for a few years and this will be my
first Antlr project. 
So far I'm kicking myself I didn't jump to Antlr sooner. This forum
,docs, articles and examples are Top.




 
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