A formulation of the concrete syntax of C for use by tools.
See syntax-for-tools for background.
The concrete syntax of C is defined in [C]. Here we provide a formulation of the concrete syntax of C that is tailored to tools that manipulate C code, and in particular that matches the abstract syntax defined in abstract-syntax.
We start with an ABNF grammar that is based on the grammar in [C], but is not identical to that grammar because its purpose is to capture constructs both before and after preprocessing at the same time. Initially it actually only captures preprocessed code, but we plan to add a growing collection of preprocessing constructs. See grammar.
We will complement the ABNF grammar with extra-grammatical predicates that specify additional constraints on the grammar, leading to a precise definition of the concrete syntax.
Note that this and [C] are just two different formulations (each formulation consisting of a grammar and of extra-grammatical requirements) of the same unique concrete syntax of C. We are not defining a different concrete syntax of C here. However, we are instantiating certain aspects of the concrete syntax which [C] leaves open, such as the exact character set used.
We plan to add a parser and a pretty-printer.