[dev] semicolons

From: pancake <pancake_AT_youterm.com>
Date: Fri, 18 Nov 2011 11:40:10 +0100

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
Received on Fri Nov 18 2011 - 11:40:10 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 18 2011 - 11:36:04 CET