[syntax][pseudo] Add Grammar for the clang pseudo-parser
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 19 Jan 2022 12:14:57 +0000 (13:14 +0100)
committerHaojian Wu <hokein.wu@gmail.com>
Thu, 3 Feb 2022 10:28:27 +0000 (11:28 +0100)
commit20e05b9f0ebea35076b96c89257becd35d6de859
treef597d1623b991592c5d1bd7beb781b72b32c4ef1
parentdc6a344637a6417aedf85e5fd1236e7fcd43c3f1
[syntax][pseudo] Add Grammar for the clang pseudo-parser

This patch introduces the Grammar class, which is a critial piece for constructing
a tabled-based parser.

As the first patch, the scope is limited to:
  - define base types (symbol, rules) of modeling the grammar
  - construct Grammar by parsing the BNF file (annotations are excluded for now)

Differential Revision: https://reviews.llvm.org/D114790
clang/include/clang/Tooling/Syntax/Pseudo/Grammar.h [new file with mode: 0644]
clang/lib/Tooling/Syntax/CMakeLists.txt
clang/lib/Tooling/Syntax/Pseudo/CMakeLists.txt [new file with mode: 0644]
clang/lib/Tooling/Syntax/Pseudo/Grammar.cpp [new file with mode: 0644]
clang/lib/Tooling/Syntax/Pseudo/GrammarBNF.cpp [new file with mode: 0644]
clang/unittests/Tooling/Syntax/CMakeLists.txt
clang/unittests/Tooling/Syntax/Pseudo/CMakeLists.txt [new file with mode: 0644]
clang/unittests/Tooling/Syntax/Pseudo/GrammarTests.cpp [new file with mode: 0644]