From: | sestoft@ellemose.dina.kvl.dk (Peter Sestoft) |
Newsgroups: | comp.compilers |
Date: | 20 Mar 1998 11:40:54 -0500 |
Organization: | RVAU |
References: | 98-03-032 98-03-098 98-03-141 98-03-147 98-03-159 98-03-183 |
Keywords: | syntax, comment |
Stefan Monnier <monnier@tequila.cs.yale.edu> writes:
(1) What languages allow recursive comments ?
Standard ML does:
[1, (* 2 (* 3 *) 4 *) 5]
evaluates to the list [1, 5].
And ["(*", "1", "*)"]
evaluates to the list ["(*", "1", "*)"].
(2) What languages enforce a "lexing" of the content of comments
(so that an end-comment inside a string inside a comment is ignored) ?
Standard ML doesn't. Would it be useful? It would prevent you from
writing comments containing otherwise innocent TeX code such as
(* Chalmers, G\"oteborg, Sverige *)
[C does if you count #if 0 as a comment. -John]
Right on (1) but not on (2) --- as far as I can see.
Peter Sestoft
--
Department of Mathematics and Physics * http://www.dina.kvl.dk/~sestoft/
Royal Veterinary and Agricultural University * Tel +45 3528 2334
Thorvaldsensvej 40, DK-1871 Frederiksberg C, Denmark * Fax +45 3528 2350
[Sure it does. Consider this C source:
#if 0
int first;
/*
#endif
int second;
#if 0
*/
int third;
#endif
C considers this to be completely blank and does not see the
definition of second, since the first endif is inside a
comment. Strings and #if don't interact because #if has to be the
first thing on a line and C doesn't permit multi-line strings. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.