Related articles |
---|
[4 earlier articles] |
Re: Techniques for writing an interpreter hgg9140@heckle.ca.boeing.com (1998-03-18) |
recursive comments and Re: Techniques for writing an interpreter monnier+comp/compilers/news/@tequila.cs.yale.edu (Stefan Monnier) (1998-03-20) |
Re: recursive comments and Re: Techniques for writing an interpreter sestoft@ellemose.dina.kvl.dk (1998-03-20) |
Re: recursive comments and Re: Techniques for writing an interpreter monnier+comp/compilers/news/@tequila.cs.yale.edu (Stefan Monnier) (1998-03-20) |
Re: recursive comments and Re: Techniques for writing an interpreter bjartem@idi.ntnu.no (Bjarte MayanjaĆstvold) (1998-03-24) |
Re: recursive comments and Re: Techniques for writing an interpreter pilz@ifi.unizh.ch (1998-03-24) |
Re: recursive comments and Re: Techniques for writing an interpreter sethml@ugcs.caltech.edu (1998-03-24) |
From: | sethml@ugcs.caltech.edu (Seth LaForge) |
Newsgroups: | comp.compilers |
Date: | 24 Mar 1998 22:53:59 -0500 |
Organization: | California Institute of Technology, Pasadena |
References: | 98-03-032 98-03-098 98-03-141 98-03-147 98-03-159 98-03-183 98-03-191 |
Keywords: | syntax |
On 20 Mar 1998 11:40:54 -0500, Peter Sestoft <sestoft@ellemose.dina.kvl.dk> wrote:
>Stefan Monnier <monnier@tequila.cs.yale.edu> writes:
> (1) What languages allow recursive comments ?
>
> (2) What languages enforce a "lexing" of the content of comments
> (so that an end-comment inside a string inside a comment is ignored) ?
>
> [C does if you count #if 0 as a comment. -John]
>
>Right on (1) but not on (2) --- as far as I can see.
Actually, our Esteemed Moderator is right on both counts. Officially,
even code which is #ifdefed out goes through the lexer, although ISTR
encountering a few cpps which don't follow that rule.
As an example, the following should be accepted by the preprocessor
(gcc's accepts it):
#if 0
"/*"
#endif
I discovered this back when I was younger and more foolish, when I
tried to use #if 0 for all of my comments in a program. The
preprocessor got rather upset by an unmatched ''' within a comment:
#if 0
That's a shame.
#endif
Seth
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.