|how to translate BOTH source language AND source comments? firstname.lastname@example.org (Warren Pilgrim) (2003-02-21)|
|From:||"Warren Pilgrim" <email@example.com>|
|Date:||21 Feb 2003 01:20:42 -0500|
|Keywords:||question, parse, comment|
|Posted-Date:||21 Feb 2003 01:20:41 EST|
I want to translate a language that allows embedded comments anywhere,
to C, retaining the comments in place, and line breaks. The comments
have their own syntax which also have to be translated. How can YACC,
say, be interrupted to recognize a comment, translate that (replace
the comment-start comment-text comment-stop sequence), then resume
parsing? Does this problem have a jargon-name? I.e., is there a
standard solution, or an alternative to Lex/YACC or Flex/Bison?
[The usual approach is to hang the comment text on an adjacent token.
Return to the
Search the comp.compilers archives again.