RE: Java Comment-Preserving Grammar

"Matthew Herrmann" <>
30 May 2004 13:17:56 -0400

          From comp.compilers

Related articles
Java Comment-Preserving Grammar (2004-05-24)
RE: Java Comment-Preserving Grammar (Quinn Tyler Jackson) (2004-05-30)
RE: Java Comment-Preserving Grammar (Matthew Herrmann) (2004-05-30)
RE: Java Comment-Preserving Grammar (Matthew Herrmann) (2004-05-30)
RE: Java Comment-Preserving Grammar (Quinn Tyler Jackson) (2004-06-21)
| List of all articles for this month |

From: "Matthew Herrmann" <>
Newsgroups: comp.compilers
Date: 30 May 2004 13:17:56 -0400
Organization: Compilers Central
References: 04-05-075 04-05-077
Keywords: Java, parse
Posted-Date: 30 May 2004 13:17:56 EDT

Hi Quinn,

Thanks for your detailed response. It does look like these solutions
are outside the scope of my work. It is interesting that something
with obvious applications in hypertext markup of source code is still
in theoretical development -- but the wheels are turning as you show!

I have found a relatively cheap way to handle comments, which involves
pre-filtering those of interest and making them first class elements of
my parse tree.

The standard java grammar has then been augmented to support these new


public /*#result*/ int x;


public result int x;

when I parse it. It looks like this area of grammars and parsing
is still in (active) development.

It's not what I was originally after, but at least it can automatically
catch mistyped /*# ... */ comments at the parsing phase, which wouldn't be
possible by my original idea.

Many thanks again,

Post a followup to this message

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