As pointed out in the previous review section, having a dedicated accept
action doesn't seem to be necessary. This patch implements the the same behavior
without accept acction, which will save some code complexity.
Details
- Reviewers
sammccall - Commits
- rG7a05942dd0c5: [pseudo] Remove the explicit Accept actions.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This is a great simplification, thanks!
clang-tools-extra/pseudo/lib/GLR.cpp | ||
---|---|---|
117–119 | rather than mingling this with the glrReduce, I'd suggest collecting the set of final heads first and then analyzing them afterwards. This means looping a second time, but I think the logic around recognizing patterns that look like accept might grow (e.g. if we want to incorporate some error tolerance) |
pull out the logic of detecting acceptable state out of glrReduce callback.
clang-tools-extra/pseudo/lib/GLR.cpp | ||
---|---|---|
117–119 | that sounds reasonable, but it requires some additional changes (to identify inactive heads in the callback of glrReduce):
|
clang-tools-extra/pseudo/lib/GLR.cpp | ||
---|---|---|
117–119 | Hmm, I'm not sure whether the conditional or unconditional version is better, and we're really borrowing problems from the future here. Let's go back to this simplest version, and update the opaque forest node comment below to a FIXME. | |
118 | this line introduces a requirement that the start symbol be a nonterminal - if this is new, can we doc it? |
switch to the previous simple version
clang-tools-extra/pseudo/lib/GLR.cpp | ||
---|---|---|
118 | this is not a new requirement, it is rather implicit previously (we use G.findNonterminal to pass the start-symbol argument of the glrParse). I added an assertion in the glrParse. It would be nice to diagnose it in the bnf grammar parsing time (will add a followup patch). |
clang-tools-extra/pseudo/lib/GLR.cpp | ||
---|---|---|
118 | FWIW I think an assertion (and possibly a comment) is the right tradeoff here, maintaining diagnostics for all this stuff seems like overkill |
clang-tools-extra/pseudo/lib/GLR.cpp | ||
---|---|---|
118 | Fair enough. I underestimated the effort of doing this stuff (we need to adjust a few existing tests in GrammarTests as well). |
this line introduces a requirement that the start symbol be a nonterminal - if this is new, can we doc it?