1
0
Fork
You've already forked ccpp
0
Contemporary C89 Preprocessor
  • Makefile 100%
2026年06月21日 00:57:35 +09:00
doc doc: merge from dev 2026年06月21日 00:57:35 +09:00
.gitignore feat: add .gitignore 2026年06月01日 23:18:15 +09:00
config.mk feat: add basic files 2026年06月01日 22:56:47 +09:00
CONTRIBUTING.md feat: add basic files 2026年06月01日 22:56:47 +09:00
LICENSE feat: add basic files 2026年06月01日 22:56:47 +09:00
Makefile fix: replace placeholder with project name 2026年06月01日 23:17:36 +09:00
README.md doc: merge from dev 2026年06月02日 12:13:40 +09:00

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.