[llvm-dev] Tablegen Grammar "include" as a keyword

Sean Silva via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 10 12:35:58 PDT 2019

It's great to see work on improving language support for TableGen in tools!

"include" is technically a preprocessing directive in TableGen. It is not a
keyword of the TableGen grammar proper, just as "include" is not a keyword
in the C/C++ grammar. E.g. "include" is not listed in section "2.11
Keywords [lex.key]" in the C++ language standard
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf>, but
rather only mentioned in a highly specific way in "16 Preprocessing
directives [cpp]".

We mention TableGen's include mechanism briefly in

TableGen has an include mechanism. It does not play a role in the syntax
per se, since it is lexically replaced with the contents of the included

IncludeDirective ::=  "include" TokString
Since that's the only "preprocessing" TableGen has, we don't have a while
explicit section (analogous to "16 Preprocessing directives [cpp]" in the
C++ standard) giving more details on the TableGen "preprocessor" in this
sense. We maybe should, technically speaking.

TableGen's top-level grammar production is `TableGenFile ::=  Object*`,
analogous to C++'s "translation-unit" production.

-- Sean Silva

On Fri, Oct 4, 2019 at 10:50 AM Codetector via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Was in the process of creating an TabelGen plugin for IntelliJ IDEs,
> wondering why in the documentation "include" is not listed as a keyword?
> Yaotia
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191010/f2254124/attachment.html>

More information about the llvm-dev mailing list