|REQ: Non-commented lines of code firstname.lastname@example.org (1995-04-28)|
|Re: REQ: Non-commented lines of code email@example.com (1995-05-09)|
|From:||firstname.lastname@example.org (John Hagerman)|
|In-Reply-To:||email@example.com's message of Fri, 28 Apr 1995 15:59:46 GMT|
|Organization:||Carnegie Mellon University|
|Date:||Tue, 9 May 1995 04:29:15 GMT|
firstname.lastname@example.org (Brian Edginton) writes:
> Looking for a tool (preferably PD) that will count lines of code.
> I would prefer a tool that is part of a set of tools or generates
> some sort of uniform output.
> [Great theological arguments are possible about what's a line of code,
> particularly in languages like C and Pascal where statement boundaries and
> line boundaries are unrelated. If you're satsified with a naive definition,
> e.g. a C statement is something that starts with a keyword and/or ends with
> a semicolon, you can whip up a comment-ignoring statement counter in about
> a dozen lines of flex. -John]
Here's something trivial. Replace ... with a comma-separated list of
sub-directories to look in. I use .x and .y for lex and yacc files.
The first output is just the line (word, character) count output from
wc. The second output is the wc output from "blank or comment" lines.
echo "blank-or-comment lines:"
grep -h '\(^$\)\|\(^ \*\)\|\(^[ ]*/\*\)' $files | wc
Return to the
Search the comp.compilers archives again.