how to translate BOTH source language AND source comments?

"Warren Pilgrim" <warren_pilgrim@hotmail.com>
21 Feb 2003 01:20:42 -0500

          From comp.compilers

Related articles
how to translate BOTH source language AND source comments? warren_pilgrim@hotmail.com (Warren Pilgrim) (2003-02-21)
| List of all articles for this month |
From: "Warren Pilgrim" <warren_pilgrim@hotmail.com>
Newsgroups: comp.compilers
Date: 21 Feb 2003 01:20:42 -0500
Organization: AT&T Worldnet
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.
-John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.