p9kcc - a transpiler for testing portability of C code
p9kcc will be a C89-to-Python3 transpiler (it is still very far from being complete) that is intended to be maximally weird in every way allowed by the C89 standard.
It's main purpose is for testing portability of C code, with focus on things
that -fsanitize=undefined and cppcheck cannot detect.
"Features":
- Weird
CHAR_BIT. Instead of 8 it is 100, socharcan have values up to2^99-1instead of the usual maximum of 127 or 255. - C99 and other "modern" stuff is mostly unavailable.
- The optional fixed-width types
int32_tetc. are absent (but I might even removeinttypes.hentirely, since it's not part of C89). - Maximum line length after
\-joining lines is 509 characters.
Status
Mostly done:
- Pre-processor
- Type parsing
In progress:
- Declaration parsing
- Expression parsing
To do:
- Statement parsing
- Basic block handling (Python does not have
goto) - Code output
Licence
Copyright © 2026 Samuel Lidén Borell.
This software is free/libre/open source software. You may distribute it and/or modify it under the terms of either of the following licences:
- EUPL version 1.2 or (at your option) any later version, or
- LGPL version 2.1 or (at your option) any later version.
As with any free/open source project, for any code/content that you contribute, you accept that it will be permanently made available, modified, used, and sublicenced, according to the licences above.
The EUPL licence can be found in the file LICENSE.txt, and the LGPL
licence can be found in the file lgpl-2.1.txt.
The + in file headers etc., for example EUPL-1.2+, should be read as
"or any later version". It still refers to the same EUPL version 1.2 licence.
