How mshockwave/nacro works
Main Components
a) Core Components (Central Focus):
• Nacro Parser (NacroParsers.h/cpp)
• Nacro Expander (NacroExpanders.h/cpp)
• Nacro Verifier (NacroVerifier.h/cpp)
• Nacro Rule Manager (NacroRule.h/cpp)
• Pragma Handler (NacroPragmaHandler.cpp)
b) External Dependencies:
• LLVM/Clang Infrastructure
• C/C++ Compiler Pipeline
Component Relationships
[Source Code with #pragma nacro]
• ↓
[Clang Preprocessor]
• ↓
[Pragma Handler] → [Nacro Parser]
• ↓
[Nacro Rule Manager] ← → [Nacro Verifier]
• ↓
[Nacro Expander]
• ↓
[Generated C/C++ Code]
Specific Details
a) Parser Section:
• Parsing of nacro rules
• Syntax validation
• Token processing
b) Rule Management:
• Rule storage and retrieval
• Rule validation flow
c) Expansion Section:
• Demonstrate macro expansion process
• Protection mechanisms (expression protection, capture detection)
• Loop handling
Additional Elements
• Unit Tests (unittest/)
• Integration Tests (test/)
• Playground (Playground/)
• A "Build System" section showing:
• CMake configuration
• LLVM/Clang integration
• Plugin compilation
Important Notes
• Plugin nature of the system by showing clear integration points with Clang
• Transformation pipeline from nacro syntax to expanded C/C++ code
• Safety features that differentiate it from traditional macros
• Validation and verification flows
Technical Details to Note
• LLVM/Clang version dependency (10.0.0)
• Platform support (Linux x86_64, partial MacOS)
• Build requirements and dependencies