[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-05-03 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 426679. hokein marked 6 inline comments as done. hokein added a comment. address remaining comments: - return GSS::node in the NewHeadCallback, rather the fields of GSS::Node; - remove the unncessary NewHeadResult structure in unittest; Repository: rG LLVM

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-05-03 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision. sammccall added a comment. This revision is now accepted and ready to land. This looks really good, great job on the signatures & tests. There are a few different ways to formulate the signatures of glrParse/glrReduce, and some possible optimizations, but I can't

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-05-02 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 426493. hokein added a comment. Fix the bad format from lint. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121150/new/ https://reviews.llvm.org/D121150 Files: clang-tools-extra/pseudo/include/clang-pseudo/Fo

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-05-02 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 426488. hokein marked an inline comment as done. hokein added a comment. Herald added a project: clang-tools-extra. Updates: - a derived version of D122408 and D121368 ; - refine the APIs, g

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein marked 13 inline comments as done. hokein added a comment. splitting the forest data structure to https://reviews.llvm.org/D122139, comments around Forest.h/.cpp should be addressed. Comment at: clang/include/clang/Tooling/Syntax/Pseudo/Forest.h:57 + }; + uint32_t sta

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clang/include/clang/Tooling/Syntax/Pseudo/Forest.h:30 +// A node in a forest. +class ForestNode { +public: sammccall wrote: > I wonder if we should put these in a namespace `forest::Node` rather than > giving them the

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 413788. hokein added a comment. fix a subtle bug where we might leave an unremoved node in the reduce path. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121150/new/ https://reviews.llvm.org/D121150 Files: cl

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-07 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. Nice! Some early comments, I haven't gotten deep into the GLR algorithm itself Comment at: clang/include/clang/Tooling/Syntax/Pseudo/Forest.h:9 +// +// Parse forest is the output of the GLR parser. +// nit: i think we should reverse t

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 413609. hokein added a comment. some tweaks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121150/new/ https://reviews.llvm.org/D121150 Files: clang/include/clang/Tooling/Syntax/Pseudo/Forest.h clang/includ

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. This is an initial version, not unittests yet, but it should be good enough for high-level reviews. Basically, it contains all key pieces of the GLR parser: - ForestForest: it is a DAG with compact nodes (8 bytes per node). It is not mutable by design. The code is mostl

[PATCH] D121150: [pseudo][WIP] Implement a GLR parser.

2022-03-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added subscribers: mgrang, mgorny. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang. This patch implements a standard(Tomita's) GLR