Skip to content

ab25cq/ccpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ccpp — a tiny toy C preprocessor

Features (initial):

  • Supports simple object-like #define NAME VALUE macros (no args)
  • Replaces identifiers in code, skipping string literals and comments
  • Reads from a file path or stdin; writes to stdout

Usage:

  • Build: make -C ccpp
  • Test: make -C ccpp test
  • Run: ./ccpp/ccpp [input.c] > output.c

Header scans:

  • Linux (curated): make -C ccpp test-linux-core-headers
  • Linux (broad): make -C ccpp test-linux-headers (see Makefile for variants)
  • macOS (C/Unix only): make -C ccpp test-macos-c-unix-headers

Limitations (by design for now):

  • No #include, conditionals, or function-like macros
  • No macro redefinition/undef tracking beyond last definition wins
  • Block comments are skipped at a basic level; nested comments not supported

Pragmas:

  • #pragma once is honored internally to avoid duplicate includes.
  • Other #pragma directives are suppressed in output by default. Set CCPP_PRESERVE_PRAGMAS=1 to pass them through unchanged.

ccpp

About

cpp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors