[PATCH] D121368: [pseudo][WIP] Build Ambiguous forest node in the GLR Parser.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 16:43:20 PDT 2022


sammccall added inline comments.


================
Comment at: clang/lib/Tooling/Syntax/Pseudo/GLRParser.cpp:285
+        ForestChildren.push_back(PN->Parsed);
+      const ForestNode &ForestNode = ParsedForest.createSequence(
+          ReduceSymbolID, RA.ReduceRuleID, ForestChildren.front()->startLoc(),
----------------
sammccall wrote:
> avoid same name for type & variable
how can we be sure we're not creating duplicate forest nodes?

IIUC, it's possible to have the same forest nodes on top of several heads of the stack.
Distinct GSS nodes due to different states, but same forest nodes.

Then the states may have overlapping itemsets, and both allow the same reduction.
Here we unconditionally produce a forest sequence node for each ReduceAction, and we will have two ReduceActions with the same forestnodes on the stack.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121368



More information about the cfe-commits mailing list