- Makefile 100%
| doc | doc: merge from dev | |
| .gitignore | feat: add .gitignore | |
| config.mk | feat: add basic files | |
| CONTRIBUTING.md | feat: add basic files | |
| LICENSE | feat: add basic files | |
| Makefile | fix: replace placeholder with project name | |
| README.md | doc: merge from dev | |
ccpp - Contemporary C89 Preprocessor
#include <ccpp.h>Overview
ccpp is a contemporary C89 preprocessing lexer library. It tokenizes ISO/IEC 9899:1990 (C89) source code and handles all preprocessor directives internally, emitting a stream of final tokens ready for parsing. It is designed for building compilers, language implementations, linters and static analysis tools.
ccpp avoids legacy cruft: it removes trigraph support and non-ASCII assumptions that burden traditional C preprocessors, making it a clean, modern foundation for language tools.
Installation
Requirements:
- POSIX-compliant Make
- C compiler with ISO/IEC 9899:1990 (C89) support
- C standard library
Build from source:
$ git clone https://codeberg.org/woohyun/ccpp.git
$ cd ccpp
$ make
$ make test
# make install
Note: the default installation path is /usr/local/ directory
Example
#include <ccpp.h>
int
main(void)
{
struct ccpp *pp;
struct ccpp_token tok;
if ((pp = ccpp_open("foo.c")) == NULL)
return -1;
do {
tok = ccpp_next(pp);
/* do something with tok */
ccpp_free(&tok);
} while (tok.kind != CCPP_EOF);
ccpp_close(pp);
return 0;
}
Documentation
See API Reference for details.
License
ccpp by Woohyun Joh is released into the public domain under [CC0 1.0 Universal][0].
You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.