Re: Java Comment-Preserving Grammar

glen herrmannsfeldt <gah@ugcs.caltech.edu>
9 Jun 2004 00:23:21 -0400

          From comp.compilers

Related articles
[2 earlier articles]
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)
Re: PL/I syntax, was Java Comment-Preserving Grammar alexc@std.com (Alex Colvin) (2004-06-21)
Re: PL/I syntax, was Java Comment-Preserving Grammar Peter_Flass@Yahoo.com (Peter Flass) (2004-06-26)
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 9 Jun 2004 00:23:21 -0400
Organization: Comcast Online
References: 04-05-075 04-06-004
Keywords: Java, lex
Posted-Date: 09 Jun 2004 00:23:21 EDT

Jens Troeger wrote:


(snip)


> 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....


Would it be that hard? Most languages that I know
of allow comments in places where blank space is allowed.


I suppose in most cases blanks are removed by the lexer, and
so not included in the grammar, though I don't think
it would be all that hard to add them in in the places
they are allowed.


It might not look so nice, though.


-- glen


Post a followup to this message

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