Skip to main content

Code Models


Code models are abstract representations of source code


You can use any of Rascal's Values to represent facts about source code. For example, Algebraic Data Types can be used to define abstract syntax trees and Relation are used to represent call graphs. We consistently use Locations to refer to source code artifacts, either physically (|file:///tmp/|) or logically (|java+class://java/lang/Object|).

Specifically we have standardized a set of models to represent source code which are ready for computing metrics: M3. This M3 model consists of:

  • an open (extensible) set of Relations between source code artifacts.
  • a number of extensible Algebraic Data Types for representing abstract syntax trees.

The core language independent model can be found here: analysis::m3.

Extensions for representing facts about specific languages: