Skip to main content

Code Models

rascal-0.34.0

Synopsis

Code models are abstract representations of source code

Description

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/HelloWorld.java|) 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: