Statements
Statements
Oddly enough just about every language you can imagine has some measure of
a statement. Even English. Some statements may be simpler than others, but
the number of statements is still a better estimate of complexity than the
number of lines or bytes.
So how would one count statements?
For XML, I would count each (nonwhitespace) node that would be generated in a dom.
This means that <foo></foo>
and <foo/>
would both have value "1", and
<foo>bar</foo>
and <foo/><py q="q" r="r" s="s" t="t"/>
would both have
value "2".
For JavaScript and Perl a statement is generally delimited by a newline or
a semicolon.
For C/C++, statements are generally delimited by semicolons or
parentheses.
x=x+1;++y;r*=5+3/p; /*3 statements*/
for (a=0;b<4;c++) b+=c; /*5 statements*/
while
(
0
)
{
}
/*1 statement */
An icon containing 4 images would be assigned a value "4". And an xbm
containing 1 images would be assigned a value "1". This means your average
xbm loses value (sorry).