All Projects → specs-feup → clava

specs-feup / clava

Licence: Apache-2.0 license
C/C++ Source-to-Source Tool based on Clang

Programming Languages

java
68154 projects - #9 most used programming language
c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
javascript
184084 projects - #8 most used programming language
Makefile
30231 projects
CMake
9771 projects

Projects that are alternatives of or similar to clava

claw-compiler
CLAW Compiler for Performance Portability
Stars: ✭ 38 (-30.91%)
Mutual labels:  transpiler, source-to-source
elephize
Typescript to PHP translation tool
Stars: ✭ 27 (-50.91%)
Mutual labels:  transpiler
C2go
⚖️ A tool for transpiling C to Go.
Stars: ✭ 1,736 (+3056.36%)
Mutual labels:  transpiler
Transcrypt
Python 3.7 to JavaScript compiler - Lean, fast, open! -
Stars: ✭ 2,502 (+4449.09%)
Mutual labels:  transpiler
Rosid
Just-in-time development server and static site generator.
Stars: ✭ 139 (+152.73%)
Mutual labels:  transpiler
Retyped
Access 3600+ libraries from C# and let Bridge.NET compile your project into JavaScript.
Stars: ✭ 216 (+292.73%)
Mutual labels:  transpiler
Ply
Painless polymorphism
Stars: ✭ 117 (+112.73%)
Mutual labels:  transpiler
dragon
Dragon is a universal Python translater.
Stars: ✭ 26 (-52.73%)
Mutual labels:  transpiler
sherlock.py
Sherlock is transpiler that translate python to shell script language.
Stars: ✭ 65 (+18.18%)
Mutual labels:  transpiler
Rockstar Js
JavaScript transpiler for the esoteric language 'Rockstar'
Stars: ✭ 189 (+243.64%)
Mutual labels:  transpiler
C2rust
Migrate C code to Rust
Stars: ✭ 2,111 (+3738.18%)
Mutual labels:  transpiler
Swiftrewriter
A Swift Package Manager console app and library to convert Objective-C code into Swift.
Stars: ✭ 140 (+154.55%)
Mutual labels:  transpiler
Moonscript
🌙 A language that compiles to Lua
Stars: ✭ 2,694 (+4798.18%)
Mutual labels:  transpiler
Webpack Babel Env Deps
Find dependencies to transpile with Babel.
Stars: ✭ 130 (+136.36%)
Mutual labels:  transpiler
dotlin
Kotlin to Dart compiler
Stars: ✭ 212 (+285.45%)
Mutual labels:  transpiler
Rbql
🦜RBQL - Rainbow Query Language: SQL-like language for (not only) CSV file processing. Supports SQL queries with Python and JavaScript expressions
Stars: ✭ 118 (+114.55%)
Mutual labels:  transpiler
Aesara
Aesara is a fork of the Theano library that is maintained by the PyMC developers. It was previously named Theano-PyMC.
Stars: ✭ 145 (+163.64%)
Mutual labels:  transpiler
Plus
This project is being developed privately.
Stars: ✭ 215 (+290.91%)
Mutual labels:  transpiler
cxgo
Tool for transpiling C to Go.
Stars: ✭ 234 (+325.45%)
Mutual labels:  transpiler
sbt-babel
An SBT plugin to perform Babel compilation.
Stars: ✭ 12 (-78.18%)
Mutual labels:  transpiler

Clava

Clava is a C/C++/CUDA/OpenCL source-to-source compiler. It applies analysis and transformations written in JavaScript scripts, and can be installed in under a minute.

If you have used Clava, please consider filling the Clava User Experience Feedback form (it's short, really!)

Clava also supports LARA files (.lara), but the LARA DSL is now considered legacy, please use JavaScript instead.

Compatibility

Currently Clava requires Java 11.

Although Clava is mainly a Java program, which should run on any compatible Java runtime, it also uses compiled binaries. These have operating system restrictions. Currently Clava is supported in Windows 10, Ubuntu 20.04, CentOS 7 and MacOS 11 (Big Sur).

Quickstart

Clava Web-based Tutorial - 2022 - Tutorial on how to use Clava, based on the online demo version.

Language Specification - List of all join points, attributes and actions available in Clava.

API Documentation - List of LARA APIs available in Clava.

API Slides - Introduction to Clava and the LARA Framework APIs.

For a sample of Clava examples, please check the Unit Tests.

Installing

A ZIP file with the last compiled JAR for Clava can be downloaded from here (previous releases).

There is an installation script for Linux that can be run locally and that will install the Clava binary in the script path (sudo is required for CMake module installation).

For an online demo version of Clava, please click here.

To call Clava from within CMake, please click here.

To build Clava, please check the ClavaWeaver project folder.

Running Clava

Clava can be run from CMake, using a GUI, or as a command-line tool.

CMake

Instructions for the Clava CMake plugin can be found here.

GUI

Run the JAR with passing parameters, e.g.:

java -jar Clava.jar

A video demonstrating the GUI can be found here.

Command Line

There are two main modes in command line, either passing all arguments (LARA file, parameters, etc...), or passing a configuration file that was built with the graphical user interface.

Using parameters:

java -jar Clava.jar <aspect.lara> -p <source_folder>

where <aspect.lara> is the LARA aspect you want to execute, and <source_folder> is the folder where the source code is.

There are more command-line options available, which can be consulted by running:

java -jar Clava.jar --help

Configuration file:

To pass a configuration file, use the flag -c:

java -jar Clava.jar -c <config.clava>

where <config.clava> is the configuration file created with the GUI.

Server Mode

For short executions, most of the execution time is related to starting a JVM.

There is an experimental feature where you can call Clava in server mode. In this mode, Clava can run in the background and will wait for requests. Then you can use a compiled program that performs requests to the server.

To start Clava in server mode, use the flag -server:

java -jar Clava.jar -server

The Linux instalation script provides the clavaw program, which sends a request to a Clava server:

    clavaw <Clava flags>

Limitations

  • Only absolute paths are supported in this mode, since the server will use its own folder as the working folder. However, files defined in config files should be handled automatically, they are converted to absolute paths, using the folder of the config file as the base folder. Additionally, if inside a Lara script you need to use files, you can use Clava.getData().getContextFolder() (import clava.Clava;) to return the folder of the config file.
  • The output of the program will appear on the terminal of the server, not where clavaw runs-

Troubleshooting

Error 'Invalid or corrupt jarfile'

Check if you have at least Java 11 installed, this is the minimum version.

Error 'missing libtinfo.so.5'

On Fedora >28 systems this can be solved by installing the package ncurses-compat-libs

Error 'cannot find -lz'

Install libz package (e.g., in Ubuntu sudo apt-get install libz-dev)

Citing Clava

If you want to reference Clava in your work, please use the following publication:

João Bispo, and João MP Cardoso. Clava: C/C++ source-to-source compilation using LARA. SoftwareX, Volume 12, 2020, Article 100565. [ScienceDirect] [bibtex]

Acknowledgments

This work has been partially funded by the ANTAREX project through the EU H2020 FET-HPC program under grant no. 671623. João Bispo acknowledges the support provided by Fundação para a Ciência e a Tecnologia, Portugal, under Post-Doctoral grant SFRH/BPD/118211/2016.

Contacts

João Bispo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].