-
Notifications
You must be signed in to change notification settings - Fork 11
Home
Clava is a C/C++ (and OpenCL and CUDA...) source-to-source compiler. It parses code into an Abstract-Syntax Tree (AST), which you can analyze or transform a custom script and generate the code again.
It is based on the LARA framework, so it uses LARA scripts (basically JavaScript) to analyze and transform the AST.
Some of the things we do with Clava you could implement directly on a compiler such as gcc or Clang. Why use Clava?
- Ease of use: Clava provides a JavaScript-based interface with high-level abstractions, and can be installed in under a minute. No need to mess with the internals of a compiler;
- Gradual learning curve: you can start with simple examples, and advance to more complex transformations gradually;
- No compiler lock-in: you can do analyses/transformations with Clava, and then use any compiler to compile your code;
-
Standard Environment - Functions and objects readily available without imports.
-
Attributes Examples - Examples of the attributes in the Clava Language Specification.
-
API Examples - Examples of the Clava API.
-
Benchmarks - How to use the built-in benchmarks.
Clava uses the concept of "join points" to refer to points of interest that can be selected in the underlying AST. They work as a wrapper around the AST nodes, and are a key concept in the LARA framework which allows to reuse the same technology across source-to-source compilers for different languages.
The image below shows the available join points in Clava, and their class hierarchy relationships: