<div dir="ltr"><div>Hi,</div><div><br></div><div>thanks for the detailed explanation.</div><div><br></div><div>Kind regards,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Missatge de Yonghong Yan <<a href="mailto:yanyh15@gmail.com">yanyh15@gmail.com</a>> del dia dl., 7 d’oct. 2019 a les 14:01:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Roger, </div><div><br></div>Per my understanding, by doing the approach you described, the base language compiler would need to know the OpenMP syntax, and choose what it needs the parser to process. It would be hard to make the "parser" standalone since it depends on what base compilers can do for openmp parsing.  <div><br></div><div>Right now, ompparser processes a whole line of an omp construct. The callback mechanism we have in mind, but have not yet fully experiment, is to let base compiler passes to the ompparser a callback that can parse a single C/C++/Fortran expression and identifier. For each expression and identifier that ompparser identifies and separates, the callback would produce an opaque object associated with string-representation of the expression/identifier. All the opaque objects for a clause, e.g. "private (a, b, c)", can be iterated using an iterator provided by the ompparser. In this approach, two scannings are needed, one by ompparser to tokenize it and another by compiler to parse it. </div><div><br></div><div>Letting the compiler callback to process a list of identifiers/expressions/array section/range would work as well as long as the ompparser tells the compiler the stopping character, e.g. ")". This would need only one scan/parse by the compiler. </div><div><br></div><div>Yonghong</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2019 at 5:00 PM Roger Ferrer Ibáñez <<a href="mailto:rofirrim@gmail.com" target="_blank">rofirrim@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>very interesting development, thanks for sharing it.</div><div><br></div><div>Did you consider a more "push-like" approach along with callbacks to decouple and ease integration with existing parsers?</div><div><br></div><div>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".</div><div><br></div><div>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.<br></div><div><br></div><div>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).</div><div><br></div><div>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.<br></div><div><br></div><div>Kind regards,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Missatge de Yonghong Yan via Openmp-dev <<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>> del dia dc., 18 de set. 2019 a les 1:26:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I would like to bring to your attention the ompparser we developed. <a href="https://github.com/passlab/ompparser" target="_blank">https://github.com/passlab/ompparser</a>. We have a IWOMP'19 paper for it and the presentation (<a href="http://parallel.auckland.ac.nz/iwomp2019/slides_ompparser.pdf" target="_blank">http://parallel.auckland.ac.nz/iwomp2019/slides_ompparser.pdf</a>) gives you a quick summary of it. <div><br></div><div>Comments are most welcome. <br><div><br></div><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Yonghong Yan </div><div dir="ltr">Associate Professor</div><div dir="ltr">Department of Computer Science</div><div dir="ltr">University of North Carolina at Charlotte</div><div dir="ltr">Office: 410F Woodward</div><div dir="ltr">Phone: 704-687-8546</div><div dir="ltr">Email: <a href="mailto:yyan7@uncc.edu" target="_blank">yyan7@uncc.edu</a></div><div dir="ltr"><a href="https://passlab.github.io/yanyh/" target="_blank">https://passlab.github.io/yanyh/</a><br></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Openmp-dev mailing list<br>
<a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">Roger Ferrer Ibáñez<br></div>
</blockquote></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Roger Ferrer Ibáñez<br></div>