[all-commits] [llvm/llvm-project] 1a65c4: [pseudo] Support parsing variant target symbols.

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon May 16 01:38:35 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a65c491be712f89b36af9d828b6ccce02de37db
      https://github.com/llvm/llvm-project/commit/1a65c491be712f89b36af9d828b6ccce02de37db
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2022-05-16 (Mon, 16 May 2022)

  Changed paths:
    M clang-tools-extra/pseudo/benchmarks/Benchmark.cpp
    M clang-tools-extra/pseudo/fuzzer/Fuzzer.cpp
    M clang-tools-extra/pseudo/include/clang-pseudo/GLR.h
    M clang-tools-extra/pseudo/include/clang-pseudo/Grammar.h
    M clang-tools-extra/pseudo/include/clang-pseudo/LRGraph.h
    M clang-tools-extra/pseudo/include/clang-pseudo/LRTable.h
    M clang-tools-extra/pseudo/lib/GLR.cpp
    M clang-tools-extra/pseudo/lib/Grammar.cpp
    M clang-tools-extra/pseudo/lib/LRGraph.cpp
    M clang-tools-extra/pseudo/lib/LRTable.cpp
    M clang-tools-extra/pseudo/lib/LRTableBuild.cpp
    M clang-tools-extra/pseudo/lib/cxx.bnf
    A clang-tools-extra/pseudo/test/glr-variant-start.cpp
    M clang-tools-extra/pseudo/tool/ClangPseudo.cpp
    M clang-tools-extra/pseudo/unittests/GLRTest.cpp
    M clang-tools-extra/pseudo/unittests/GrammarTest.cpp

  Log Message:
  -----------
  [pseudo] Support parsing variant target symbols.

With this patch, we're able to parse smaller chunks of C++ code (statement,
declaration), rather than translation-unit.

The start symbol is listed in the grammar in a form of `_ :=
statement`, each start symbol has a dedicated state (`_ := • statement`).
We create and track all these separate states in the LRTable. When we
start parsing, we lookup the corresponding state to start the parser.

LR pasing table changes with this patch:
- number of states: 1467 -> 1471
- number of actions: 82891 -> 83578
- size of the table (bytes): 334248 -> 336996

Differential Revision: https://reviews.llvm.org/D125006




More information about the All-commits mailing list