# ROSE Compiler Framework/Supported Programming Languages
## Overview

ROSE supports a wide range of main stream programming languages, with different degrees of maturity. The list of supported languages includes:
* C and C++: based on the EDG C++ frontend
** An ongoing effort is to upgrade the EDG frontend to its recent 4.4 version.
** Another ongoing effort is to use clang as an alternative, open-source C/C++ frontend
* Fortran 77/95/2003: based on the Open Fortran Parser
** limitations: variables with embedded spaces are not supported.
* OpenMP 3.0: based on ROSE's own parsing and translation support for both C/C++ and Fortran OpenMP programs.
* UPC 1.1: this is also based on the EDG 3.3 frontend

## Fortran

Regression tests: tests/nonsmoke/functional/CompileTests/Fortran_tests
* to trigger individual test
** make test2020_comment_1.f90.passed
Check the detailed command line:

## OpenMP

See more at OpenMP Support
ROSE supports OpenMP 3.0 for C/C++ (and limited Fortran support).
* The ROSE manual has a chapter (Chapter 12 OpenMP Support) explaining the details. pdf
* A paper was published for the uniqueness of the ROSE OpenMP Implementation pdf
* Frontend parsing source files (ompparser.yy and ompFortranParser.C) are located under https://github.com/rose-compiler/rose/tree/master/src/frontend/SageIII
* The transformation of OpenMP into threaded code is located in omp_lowering.cpp, under https://github.com/rose-compiler/rose/blob/master/src/midend/programTransformation/ompLowering
* The OpenMP runtime interface is defined in libxomp.h and xomp.c under the same ompLowering directory mentioned above
Configuration: please always try to use --with-gomp_omp_runtime_library=/usr/apps/gcc/4.4.1/lib64/ when configuring ROSE. So the generated ROSE translators can automatically link with libgomp.a to generate executables for you. This will also allow the execution tests of the omp Lowering be executed to catch errors. Without this option, only the compile level tests will run.
Experimental OpenMP Acclerator Model Implementation
* OpenMP Acclerator Model Implementation
Testing
* There are about 70 builtin execution tests (many have self-verification) in ROSE.
Some benchmarks are used to test OpenMP support in ROSE in Jenkins (our regression test server)
* a22b-NPB-2.3-C-parallel: all 8 benchmarks pass
* a21-SPEC-OMP-64bit-parallel: 3 benchmarks pass.
* LULESH OpenMP version: download
For builtin test:
* source files are in: https://github.com/rose-compiler/rose/tree/master/tests/nonsmoke/functional/CompileTests/OpenMP_tests
* the test driver is defined in https://github.com/rose-compiler/rose/tree/master/tests/nonsmoke/functional/roseTests/ompLoweringTests/Makefile.am . See the list of files under C_TESTCODES_REQUIRED_TO_RUN .
You have to configure the path to GOMP if you want to them to be automatically executed when "make check" is typed. e.g. ../sourcetree ... --with-gomp_omp_runtime_library=/usr/apps/gcc/4.4.1/lib64/

## UPC

UPC 1.1.1: this is based on the EDG 3.3 frontend
* The supported version is limited by the EDG 3.3 frontend, which only supports UPC 1.1.1 ( UPC VERSION string is defined as
200310L). ROSE uses EDG 3.3 currently and it originally only supported UPC 1.0. We merged the UPC 1.1.1 support from EDG 3.10 into our EDG 3.3 frontend. We have also added the required work to support UPC 1.2.
Documentation:
* Chapter 13 UPC Support, of the ROSE manual http://rosecompiler.org/ROSE_UserManual/ROSE-UserManual.pdf
Tests: make check rule under
* rose/tests/CompileTests/UPC_tests
An example UPC-to-C translator: roseupcc
* Not full featured. Only intended to serve as a start point for anybody who is interested/funded to implement UPC in ROSE
* roseupcc is located in ROSE/projects/UpcTranslation
* Documented by 13.5 An Example UPC-to-C Translator Using ROSE of the ROSE manual

## MPI

MPI is mostly a library-based programming paradigm. In many cases, you can simply compile MPI applications normally using a ROSE-based translator, as long as you pass the include path of mpi.h to the command line.
However, there are some additional support for MPI in ROSE:
1) If ROSE is configured with --with-mpi=/mpi/install/location, then the configure adds the following variables to be used in Makefile.am
These flags are useful to compile ROSE as a MPI program. One can also use the CFLAGS to pass the location of mpi.h. These flags will be set for any version of MPI as long as valid install location is passed to --with-mpi.
2)There are a few MPI-specific analysis projects (MPI_Tools, extractMPISkeleton). Some of the dataflow analysis we are working on are i) Slicing for MPI communication ii) MPI communication invariant analysis ( prove that communication is constant in loops). We currently plan on using these analyses with other standard dataflow analyses to
* Parallel control-flow graph analysis -- build communication graph of the MPI program with no input dependent control-flow or communication
* Transformation to cDAG -- cDAG is runtime communication optimizer tool for MPI by Torsten Hoefler. We intend to replace MPI calls with cDAG calls to optimize for communication.

## CUDA

ROSE has an experimental connection to EDG 4.0, which helps us support CUDA.
To enable parsing CUDA codes, please use the following configuration options:
Chapter 16 of ROSE User Manual has more details about this.
More details from Tristan on Sept. 24, 2012
* "--enable-cuda" option enable CUDA IR in ROSE (IR, preinclude, ...)
* "--enable-edg-cuda" option only apply to EDG: it activates the EDG support in EDG 4.x (actually I need to patch EDG 4.4)
* When "--enable-edg-cuda" is present, we also need to have "--enable-edg-version=4.x" (x = {0, 3})
* "--enable-cuda" is relevant for --enable-only-cuda as the "-edg-" options are targeting only EDG (which is usually distributed as binary).

## OpenCL

There is a section discussing this support in Chapter 16 CUDA and OpenCL of the ROSE manual pdf:

## Parser Building Blocks

Quick information:
* purpose: a set of functions to help implement recursive decent parsing for simple annotation languages, such as source code directives.
* Official doc: Chapter 33 Parser Building Blocks of ROSE tutorial [pdf http://rosecompiler.org/ROSE_Tutorial/ROSE-Tutorial.pdf]
* source files: sourcetree/src/frontend/SageIII/astFromString/AstFromString
* example use: rose/projects/pragmaParsing

## FailSafe Assertion Language

FailSafe Assertion Language An experimental source code annotation language to support resilient computing.