sammccall marked 2 inline comments as done.
sammccall added inline comments.


================
Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:621
     // Consume the token.
     glrShift(Heads, Terminals[I], Params, Lang, NextHeads);
 
----------------
hokein wrote:
> hokein wrote:
> > I think we can move the Line634 `Heads.resize(HeadsPartition)` before the 
> > `glrShift()` as we only do shift on the nearly-created heads, we might gain 
> > some performance back.
> oops, my previous comment is incorrect, here we want the second part of the 
> partition; while on recovery, we want the first part of partition.
> 
> we can pass `llvm::ArrayRef<const GSS::Node 
> *>(Heads).drop_front(HeadsPartition);` as the Heads to `glrShift`.
> 
> 
As discussed offline, shifting onto a head that was produced by shift should be 
allowed.

given grammar
```
foo := [ ]
bar := [
baz := bar ]
```
and input `[]`, after `[` we have `Heads={ [, bar} }` with the former shifted 
and the latter reduced.
If we applied your suggestion here, we would fail to parse `foo` (but would 
succeed in parsing `baz`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130523

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D130523: [pseudo] Perfo... Sam McCall via Phabricator via cfe-commits

Reply via email to