C comment stripper

John Rupley rupley at arizona.edu
Mon Mar 27 06:59:35 AEST 1989


> In article <16539 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> In article <9864 at megaron.arizona.edu> rupley at arizona.edu (John Rupley) writes:
> >Score, anyone? (recent postings tested on K&R-I-syntax code)
> >
> >	sed        1/1 correct
> >	Lex        2/2 correct
> >	C          2/2 wrong
> 
> This sounds like a CHALLENGE!  :-)

Unclear again (sob :-).  Meant it as a comment, implying the VIRTUES of
Lex (and even sed :-) for pattern matching.  Contest-wise, your C code
is the first correct as initially posted, it runs faster than the previous
postings (after correction of the latter), and one can follow the neat
state-machine implementation at first reading.

> I wrote the following working against the ten-minute spaghetti clock.

Wow! It took me longer to test it.

For what its worth (as COMMENTARY -- please, no contest), counting new
postings, too:

      sed, awk        2/3 correct as first posted (test vs K&R-I-type code)
      Lex             2/3 
      C               1/3

Hmmm.  Conclusion?  The probability of any particular piece of code being
correct is independent of language and is a toss-up (:-)?  

But I still like Lex for this particular type of problem.

John Rupley
rupley!local at megaron.arizona.edu



More information about the Comp.lang.c mailing list