ompparser is a standalone and unified OpenMP parser for both C/C++ and Fortran. It can be used as an independent tool as well as an integral component of an OpenMP compiler. It has syntax and semantics checking functionalitity for OpenMP constructs for validating and verifying usage of existing constructs. The formal grammar included in ompparser, developed with Flex and Bison tools, can help interpretation ofthe OpenMP standard. The implementation supports the full and latest OpenMP 5.0 and is is released as open-source with BSD-license.
-
clone the repo, create build folder and use cmake to create Makefile
git clone https://github.com/passlab/ompparser.git mkdir ompparser-build cd ompparser-build cmake -DCMAKE_INSTALL_PREFIX=../ompparser-install ../ompparser
-
build and install
make; make install
public class OMPAttribute {
OMPAttribute [] children; /* this could be other C/C++ vector */
OMPAttribute parent;
const char * lang_str;
}
public class OMPDirective extends OMPAttribute {
}
public class OMPClause extends OMPAttribute {
}
OpenMPDirective* parseOpenMP(const char*, void *_exprParse(const char*));
- Full OpenMP 5.0 standard support for both C/C++ and Fortran, including parsing and unparsing
- Flex lexer rules and Bison grammars for OpenMP 5.0 syntax
- Intermediate representation of OpenMP constructs
- Easy-to-use interface to parse OpenMP constructs and to emit OpenMP intermediate representation
- Syntax checking in grammar, OpenMP parsing and IR construction, and post-parsing
- Clause normalization, e.g. combining multiple shared clauses into one shared clause
- Limited semantics checking when a construct use C/C++/Fortran identifiers or expressions
- Testing driver and test cases for extensive testing of OpenMP constructs (ongoing work)
- DOT graph output of OpenMP constructs (ongoing work)
- Conversion between perfectly-nested OpenMP constructs and combined constructs (ongoing work)
- Being integrated with ROSE compiler (ongoing work)
The work has been performed with support from Department of Energy Lawrence Livermore National Laboratory and the National Science Foundation. To cite, please refer to following paper:
Please contact Yonghong Yan (@yanyh15) from github or gmail.