Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!ig!arizona!rupley From: rupley@arizona.edu (John Rupley) Newsgroups: comp.lang.c Subject: Re: C comment stripper Summary: It's neat and works Message-ID: <9893@megaron.arizona.edu> Date: 26 Mar 89 20:59:35 GMT References: <1842@viper.Lynx.MN.Org> <9543@smoke.BRL.MIL> <1453@wpi.wpi.edu> <16539@mimsy.UUCP> Organization: U of Arizona CS Dept, Tucson Lines: 35 > In article <16539@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > In article <9864@megaron.arizona.edu> rupley@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@megaron.arizona.edu