[PATCH] D121150: [pseudo] Implement the GLR parsing algorithm.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 06:32:27 PDT 2022


hokein added inline comments.


================
Comment at: clang-tools-extra/pseudo/include/clang-pseudo/GLR.h:143
+// parsing process (glrShift, or glrReduce).
+using NewHeadCallback =
+    std::function<void(LRTable::StateID NextState, const ForestNode *Parsed,
----------------
sammccall wrote:
> nit: this is always used synchronously, so llvm::function_ref?
we have a `captureNewHeads` method which returns this callback in unittest, returning llvm::function_ref is not safe -- we could make it return a std::function, but it would be nice to have a unified signature.


================
Comment at: clang-tools-extra/pseudo/unittests/GLRTest.cpp:34
+
+struct NewHeadResult {
+  LRTable::StateID State;
----------------
sammccall wrote:
> this looks so much like a GSS node: why not just use a GSS node?
oh, right. I added this because I didn't expose the GSS in the `Params` in my previous version, I needed to store the Parents. Right now it is not needed, we can use the GSS::Node directly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121150/new/

https://reviews.llvm.org/D121150



More information about the cfe-commits mailing list