← Fun stuff

Code℞

From my master's thesis, Construction of a Generic Program Representation for Automated Metric Computation · M.S. Computer Science, Clemson University, 2016


Code℞ is the applied prototype from my master's thesis. It's an online evaluator that grades programming solutions on the quality of the code, not just whether it produces the right answer — the kind of feedback that platforms like Codecademy, Code Wars, and Project Euler don't give. You submit a solution in C++ or Python and get back a report of software metrics, with the goal of nudging beginners toward code that's actually readable and maintainable.

The research behind it

Software metrics — measures like cyclomatic complexity and the Halstead suite — give a quantitative read on code quality. The problem is that the tools that compute them are almost always tied to a single language: pick your metrics, and you may not find a tool that supports the language you actually wrote your program in.

My thesis tackles that with a Generic Abstract Syntax Tree (GAST) — a language-agnostic program representation that sits one level of abstraction above an ordinary AST, capturing just the syntactic categories that metric computation needs. The approach leans on existing front-end parsers to lower a program into this shared representation (validated against an XML schema), after which any metric can be computed once, as a simple tree traversal, and reused across every language that maps into the GAST. I demonstrated it by wiring up the Python and C++ front ends and computing McCabe and Halstead metrics over three real open-source projects and a set of Project Euler solutions.

Code℞ takes that machinery and points it at computer-science education: same metrics, same generic representation, wrapped in a tool a student can actually submit to and learn from.

Read more