[antlr-interest] Comments and translation

Tom Davies tomdavies at optushome.com.au
Sun Jul 13 18:10:16 PDT 2003


Hi,

I'm writing a translator from a 4GL to Java. The input and output text
is very different. I need to preserve comments in the output, but am
finding this hard to get to grips with.

The current documentation says:
'The current "hidden token" stream filter clearly solves the "ignore but
preserve whitespace" problem really well, but it does not handle
comments too well in most situations.  For example, in real translation
problems you want to collect comments at various single tree nodes (like
DECL or METHOD) for interpretation rather than leaving them strewn
throughout the tree.  You really need a stream splitter that buffers up
the comments on a separate stream so you can say "give me all comments  
consumed during the recognition of this rule" or "give me all comments
found between these two real tokens." That is almost certainly something
you need for translation of comments.'

This is the sort of stuff I want to do, what's the current
recommendation for how to achieve it?

Thanks,
  Tom

-- 
Tom Davies <tomdavies at optushome.com.au>


 

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




More information about the antlr-interest mailing list