Psychec is a research project out of the Universidade Federal de Minas Gerais (UFMG) in Brazil that is trying to be a type inference engine for incomplete C code. Here is a small guest post by the Psyche team about their work.
Here, at the Compiler's Laboratory of UFMG, we've been trying to understand the meaning of incomplete C code. How well can a parser reason about a source when declarations (or complete headers) are missing? In the C language, challenges appear already during parsing, since, not only syntax, but also semantic information (possibly absent) is required. Yet, the really cool challenges emerge when we want to reconstruct a partial program into a complete one that passes the type-checker.
To accomplish this compilation* of an incomplete C program we have developed an unification-based algorithm (Hindley-Milner style) that is capable of inferring any missing declaration. Our project, despite being still under research, can already do quite impressive things. Maybe you want to take a look and give us some feedback? The source is
at GitHub: ltcmelo/psychec. We also offer an online interface for those who want to try things out at http://cuda.dcc.ufmg.br/psyche-c. Who said a type inference engine for C couldn't exist? ;-)
* We mean compilation without any abuse of terminology. For instance, linking might not be possible because we don't generate function stubs.