Re: Java Comment-Preserving Grammar

jens.troeger@light-speed.de (Jens Troeger)
6 Jun 2004 15:11:48 -0400

          From comp.compilers

Related articles
Java Comment-Preserving Grammar matthew-google@faredge.com.au (2004-05-24)
Re: Java Comment-Preserving Grammar sreeni@viswanadha.net (Sreenivasa Viswanadha) (2004-05-30)
Re: Java Comment-Preserving Grammar martin@cs.uu.nl (Martin Bravenboer) (2004-05-30)
Re: Java Comment-Preserving Grammar cdodd@acm.org (Chris Dodd) (2004-05-30)
Re: Java Comment-Preserving Grammar dobes@dobesland.com (Dobes Vandermeer) (2004-05-30)
Re: Java Comment-Preserving Grammar tbauer@cadrc.calpoly.edu (Tim Bauer) (2004-05-30)
Re: Java Comment-Preserving Grammar jens.troeger@light-speed.de (2004-06-06)
Re: Java Comment-Preserving Grammar clint@0lsen.net (Clint Olsen) (2004-06-06)
Re: Java Comment-Preserving Grammar gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-06-09)
Re: Java Comment-Preserving Grammar cfc@shell01.TheWorld.com (Chris F Clark) (2004-06-11)
Re: Java Comment-Preserving Grammar alexc@std.com (Alex Colvin) (2004-06-13)
Re: Java Comment-Preserving Grammar gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-06-13)
Re: Java Comment-Preserving Grammar cfc@shell01.TheWorld.com (Chris F Clark) (2004-06-15)
[2 later articles]
| List of all articles for this month |

From: jens.troeger@light-speed.de (Jens Troeger)
Newsgroups: comp.compilers
Date: 6 Jun 2004 15:11:48 -0400
Organization: http://groups.google.com
References: 04-05-075
Keywords: Java
Posted-Date: 06 Jun 2004 15:11:48 EDT

> Is there an available Java grammar which preserves comments in an
> output AST tree? I know there are plenty of java grammars out there,
> but all ignore comments. I'm happy to use any tool providing I can
> gain access to the comments in the tree.
>
> My end goal is to parse commented-out extensions to the java language:
>
> class /*#immutable*/ Blah {
>
> public /*#input*/ int x;
> public /*#result*/ int y;
>
> }
>
> Any suggestions appreciated,


As Far As I Know, A Grammar Has Nothing To Do With Comments. The
Scanner Usually Skips Over Comments In The Source Code Already,
Such That The Parser Doesn'T Even See Them. However, You Can Write
Your Own Scanner And Parser, That Make Comments Explicit In The Grammer.
But If You Want To Allow Comments _Anywhere_ In Yout Language, The
Good Luck!! :-) That Grammar Is Going To Be A Mess....


jens


--
Jens Troeger
http://savage.light-speed.de/


Post a followup to this message

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