ompparser is a standalone OpenMP parser for C/C++ and Fortran. It can be used as an independent tool or embedded into compiler pipelines. The Flex/Bison grammar parses OpenMP directives and builds an intermediate representation (IR) that supports normalization and round-trip unparsing. The implementation tracks OpenMP 6.0 constructs and is released under the BSD-3-Clause license.
-
clone the repo and configure a build directory
git clone https://github.com/ouankou/ompparser.git cmake -S ompparser -B build -DCMAKE_BUILD_TYPE=Release -
build and install
cmake --build build cmake --install build --prefix /path/to/install -
run the regression tests (requires Flex and Bison in PATH)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug cmake --build build --target check
enum OpenMPBaseLang {
Lang_C,
Lang_Cplusplus,
Lang_Fortran,
Lang_unknown
};
class OpenMPClause : public SourceLocation {
...
}
class OpenMPDirective : public SourceLocation {
...
}
extern OpenMPDirective * parseOpenMP(const char *, void * exprParse(const char * expr));
- OpenMP 6.0 standard support for both C/C++ and Fortran, including parsing and unparsing
- Flex lexer rules and Bison grammars for OpenMP 6.0 syntax
- Intermediate representation of OpenMP constructs
- Interface to parse OpenMP constructs and emit the OpenMP IR
- Syntax checking in grammar, parsing, IR construction, and post-parsing
- Clause normalization, e.g., combining multiple shared clauses into one shared clause
- Limited semantics checking when a construct uses C/C++/Fortran identifiers or expressions
- Testing driver and test cases for OpenMP constructs
- DOT graph output of OpenMP constructs
- Conversion between perfectly-nested OpenMP constructs and combined constructs (ongoing work)
Submit contribution as github pull request to this repository. We require all new contributions must be made with the similar license.
Submit feature request, bugs and questions from the repository's "Issues" tab.
The work has been performed with support from Department of Energy Lawrence Livermore National Laboratory and the National Science Foundation. To cite, please use following paper:
Anjia Wang, Yaying Shi, Xinyao Yi, Yonghong Yan, Chunhua Liao and Bronis R. de Supinski, ompparser: A Standalone and Unified OpenMP Parser, the 15th International Workshop on OpenMP (IWOMP), 11th - 13th September, in Auckland, New Zealand. The presentation of the paper, which is from IWOMP'19 website.
Anjia Wang, Yaying Shi, Xinyao Yi, Yonghong Yan, Chunhua Liao and Bronis R. de Supinski
Please contact Yonghong Yan (@yanyh15) from github or gmail.
ompparser is released under a BSD license. For more details see the file LICENSE.
LLNL-CODE-798101