Validator of the C abstract syntax for tools.
Besides syntactic validity, C code must satisfy a number of additional constraints in order to be compiled. These constraints form the static semantics of C. C compilers check that the code satisfies these constraints prior to translating it.
Here we provide a validator of C code, whose purpose is to check those constraints, i.e. to check whether the C code is valid and compilable.
We start with an approximate validator that should accept all valid C code but also some invalid C code (due to the approximation). Even in its approximate form, this may be useful to perform some validation, and to calculate information (approximate types) that may be useful for manipulating the abstract syntax (e.g. for C-to-C transformations).
In a sense, the validator extends the disambiguator, which performs an even more approximate validation, just enough to disambiguate the abstract syntax. Thus, there are structural similarities between the validator and the disambiguator.
Similarly to a compiler, the validator makes use of a symbol table, which tracks information about the symbols (identifiers) in the code. These symbol tables, called `validation tables', are, in some sense, an extension of the disambiguation tables used by the disambiguator.
We use error-value tuples to handle errors in the validator.
This validator is work in progress.