> On Fri, Nov 18, 2011 at 11:40:10AM +0100, pancake wrote:
>I've checked iolanguage.org and noticed that they are calculating the
>complexity/size
>of their vm in semicolons instead of number of lines.
>
>I think this is a much simpler way to calculate the complexity of a
>program and can be
>implemented easily with awk.
>
>using sloccount is probably cool, but sloccount is far from perfect, as
>long as can be
>tricked by using different indentations.
>
>This is why I'm considering other ways to calculate code complexity. And
>counting
>semicolons or parenthesys can be a good way to do it.
>
>What do you think?
>
>$ cat dwm.c | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l
>1131
>
>Doing it in C would be even simpler, and we can distribute it as the
>standard suckless
>tool for calculating code complexity in C programs.
>
>Counting opened parenthesis is also a nice way to check complexity.. so
>my idea is to
>write a tool like 'wc', but showing statistical info from source programs.
>
>- skip comments, quoted chars ("strings", ';') and #if0'd code
>- count lines
>- count parenthesis
>- count semicolons
>
>--pancake
Statistically speaking, it might be best at this point to use a multitude of
counting mechanisms, using both line counts and semicolon counts.
Anything can be worked around one way or another. For reference, standard
benchmark tools also never look at just "one thing".
--
Roger
http://rogerx.freeshell.org/
Received on Fri Nov 18 2011 - 12:41:00 CET