Construction of A Generic Program Representation For Automated Metric Computation