[Openmp-dev] ompparser: A Standalone and Unified OpenMP Parser

Roger Ferrer Ibáñez via Openmp-dev openmp-dev at lists.llvm.org
Fri Sep 27 14:00:12 PDT 2019


Hi,

very interesting development, thanks for sharing it.

Did you consider a more "push-like" approach along with callbacks to
decouple and ease integration with existing parsers?

This way an existing base language parser (say, hypothetically, clang or
flang) can push essential tokens that correspond to purely the directive
syntax (parallel, for, if, nowait, etc.) and then the OpenMP parser could
tell the base language parser "now parse this part of the language you know
about".

For instance, parsing a clause like "num_threads(1+2)". clang could push
tokens "num_threads", "(" and then the OpenMP parser (assuming we are
deterministic enough!) would let know clang "now parse an expression" which
would consume 1+2 and pass the expression (possibly opaquely) to the OpenMP
parser. Lastly clang would push ")" and a full num_threads has just been
recognized.

To communicate the parser that a part of the OpenMP syntax has been
recognized (in this case a num_threads clause) I imagine either a callback
could be used or perhaps the push token function could return a result
(this is less clear to me, to be honest).

One limitation of this approach would be that the base language still has
to know some OpenMP syntax bits like "a[lower:size]" for C/C++ depend
clauses. Declare reduction directive also includes a few special
identifiers (like omp_priv) that the base language parser may need to be
told about.

Kind regards,

Missatge de Yonghong Yan via Openmp-dev <openmp-dev at lists.llvm.org> del dia
dc., 18 de set. 2019 a les 1:26:

> I would like to bring to your attention the ompparser we developed.
> https://github.com/passlab/ompparser. We have a IWOMP'19 paper for it and
> the presentation (
> http://parallel.auckland.ac.nz/iwomp2019/slides_ompparser.pdf) gives you
> a quick summary of it.
>
> Comments are most welcome.
>
> Yonghong Yan
> Associate Professor
> Department of Computer Science
> University of North Carolina at Charlotte
> Office: 410F Woodward
> Phone: 704-687-8546
> Email: yyan7 at uncc.edu
> https://passlab.github.io/yanyh/
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>


-- 
Roger Ferrer Ibáñez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20190927/a63a8a18/attachment.html>


More information about the Openmp-dev mailing list