[antlr-interest] Extract Code Related Metrics
shirantha fernando
shiranthad at gmail.com
Thu Aug 11 08:14:15 PDT 2011
*Hi,*
I am totally new to Antlr C# grammar. I am trying to use the grammar to
extract C# code related metrics like *Halstead *and *Object Oriented
(according to C&K Model). *
I stuck on extracting details as following.
I need to extract *operators *and *operands *from the source code. If you
could please explain bellow scenarios I could be able to overcome the same
(Need to know in which place that I need to catch the detail from the
grammar).
Ex:-
- * Int x = 1; *
*Answer*
Operators { = }
Operands { int , x, 1 }
*
*
- *For( int k = 0; k < 10; k++) { }*
*Answer*
Operators { for(), = , =, ++ }
Operands { int, k, 0, k, 10, k }
*I need to get only the count of these Operators and Operands by
incrementing a variable*. Please be kind enough to help me. Thanks.
*Thanks and Regards,*
*Shirantha Fernando*
*( IT student)*
More information about the antlr-interest
mailing list