Page 1 of 1

how to count unique operator and opernad,functionin and out

Posted: Thu Aug 31, 2006 5:57 am
by rami
using reg ex in php i was trying to count
1)unique number of operand used in whole program
2)unique number of operator used in whole program
3)total number of operand used in whole program
4)total number of operator used in whole program

along with it
how can i count
1)fan in
that is number of calls to the function(from others unique functions)
2)fan out
number of calls from the function(to others unique functions)

any ideas

thanks

Posted: Thu Aug 31, 2006 7:35 am
by volka
I might be wrong but it sounds like the problem is beyond regular expressions and needs a parser for context-free grammars.
If you want to analyze php scripts http://de2.php.net/tokenizer may be of interest.