Skip to content

passlab/ompparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 Cannot retrieve latest commit at this time.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ompparser: A Standalone and Unified OpenMP Parser

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.

Build and usage

  1. 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 
    
  2. build and install

    make; make install
    

omparser API


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*));

Features and Limitation

  1. Full OpenMP 5.0 standard support for both C/C++ and Fortran, including parsing and unparsing
  2. Flex lexer rules and Bison grammars for OpenMP 5.0 syntax
  3. Intermediate representation of OpenMP constructs
  4. Easy-to-use interface to parse OpenMP constructs and to emit OpenMP intermediate representation
  5. Syntax checking in grammar, OpenMP parsing and IR construction, and post-parsing
  6. Clause normalization, e.g. combining multiple shared clauses into one shared clause
  7. Limited semantics checking when a construct use C/C++/Fortran identifiers or expressions
  8. Testing driver and test cases for extensive testing of OpenMP constructs (ongoing work)
  9. DOT graph output of OpenMP constructs (ongoing work)
  10. Conversion between perfectly-nested OpenMP constructs and combined constructs (ongoing work)
  11. Being integrated with ROSE compiler (ongoing work)

Acknowledge and Support

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:

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

Contact

Please contact Yonghong Yan (@yanyh15) from github or gmail.