Process C-like preprocessors permutations (by creating individual files for each permutation)
✓ Published0🌍 Public
Aadamscott
Last edited May 16, 2025
Created on May 15, 2025
This example visualizes the permutations of C-like preprocessor directives by generating a separate file for each possible conditional branch combination. It parses source lines into a fragment tree of `Either` nodes representing `if`/`else` branches, then recursively renders every permutation into distinct files. The visualization relies on Python’s `re` module for token matching, and file I/O via `Path` and `tempfile`. The rendering process uses custom `Fragment` and `Either` classes to track conditional logic, demonstrating how combinatorial preprocessor states can be systematically enumerated and output.
AI-generated description