Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

ClaiR - C Language Analysis in Rascal

ClaiR provides a mapping from the Eclipse CDT open C and C++ front-end to a Rascal M3 model for further processing.


Required software

  • Eclipse 2019-06 with CDT (C/C++ Development Tools) (see here).
  • Rascal (see here).

How to install ClaiR into Eclipse

  • In the Help menu, select Install New Software.
  • Use as an update site. Hit Add to save it for future updates.
  • Select clair_feature in the list of libraries and follow the instructions.

How to run

  • In Eclipse's Project Explorer, right click a project's folder and select Rascal Console. The console should open inside Eclipse's terminal window with the title "Rascal [project: , mode: debug]". If, instead, it shows "project: none", make sure you clicked the project and the project is actually open.
  • Import ClaiR into the console by running import lang::cpp::AST;.
  • To parse a string containing source code, call the parseString function, e.g., parseString("int foo() { return 0; }").
  • To parse source files on disk, call the parseCpp function with a source location, e.g., parseCpp(|file:///tmp/example.cpp|), parseCpp(|project://clair/src/test/test.cpp|), parseCpp(|home://myFile.cpp|), or parseCpp(|file://C:/My%20Dir/main.cpp|).
You can’t perform that action at this time.