{"id":26446475,"url":"https://github.com/lhish/macrosolver","last_synced_at":"2025-03-18T12:17:55.371Z","repository":{"id":282928817,"uuid":"950114400","full_name":"lhish/MacroSolver","owner":"lhish","description":"MacroSolver is a C++ macro expansion tool designed for parsing and expanding C/C++ preprocessor macro definitions.","archived":false,"fork":false,"pushed_at":"2025-03-17T17:10:25.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T18:27:31.310Z","etag":null,"topics":["cpp","learning","learning-by-doing","learning-cpp","macro"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lhish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-17T16:47:24.000Z","updated_at":"2025-03-17T17:10:28.000Z","dependencies_parsed_at":"2025-03-17T18:27:36.181Z","dependency_job_id":"a157651c-9512-4d46-a49e-053b7ffead8d","html_url":"https://github.com/lhish/MacroSolver","commit_stats":null,"previous_names":["lhish/macrosolver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhish%2FMacroSolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhish%2FMacroSolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhish%2FMacroSolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhish%2FMacroSolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lhish","download_url":"https://codeload.github.com/lhish/MacroSolver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244217950,"owners_count":20417677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","learning","learning-by-doing","learning-cpp","macro"],"created_at":"2025-03-18T12:17:54.610Z","updated_at":"2025-03-18T12:17:55.366Z","avatar_url":"https://github.com/lhish.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MacroSolver\n\nMacroSolver是一个C++宏展开工具，用于解析和展开C/C++预处理器宏定义，但只支持函数式宏。这个项目是学习和理解C++宏机制的最佳资源之一。\n\nMacroSolver is a C++ macro expansion tool designed for parsing and expanding C/C++ preprocessor macro definitions, but\nonly supports function-like macros. This\nproject serves as an excellent learning resource for understanding the intricacies of C++ macros.\n\n## 功能特点 / Features\n\n- 支持基本的宏定义和展开\n- 支持带参数的宏\n- 支持嵌套宏展开\n- 支持字符串化操作符 (#)\n- 支持标记连接操作符 (##)\n- 支持可变参数宏 (__VA_ARGS__)\n- 支持__VA_OPT__扩展\n- 防止宏递归展开\n\n- Basic macro definitions and expansions\n- Macros with parameters\n- Nested macro expansions\n- Stringification operator (#)\n- Token pasting operator (##)\n- Variadic macros (__VA_ARGS__)\n- __VA_OPT__ extensions\n- Prevention of recursive macro expansions\n\n## 为什么不通过编译器源码来学习宏 / Why not learn macros by studying the compiler source code?\n\nC/C++ 宏机制的底层实现细节通常隐藏在复杂的编译器源码中。理解编译器源码本身极具挑战性，需要深入掌握编译原理和底层架构。*\n*编译器源码晦涩难懂，即使是经验丰富的开发者也常常望而却步。**\n\n**相对于直接研究编译器源码，MacroSolver 提供了一个更易于理解和学习的替代方案。**  它通过简洁的代码和清晰的逻辑，展示了宏展开的核心原理。你可以通过阅读、调试和修改\nMacroSolver 的代码，更直观地理解宏展开的过程，而无需深入研究庞大而复杂的编译器源码。\n\nThis project provides a more accessible alternative to directly diving into the intricate details of compiler source\ncode. The underlying implementation of C/C++ macro mechanisms is often concealed within the complex compiler source.\nUnderstanding compiler source code is inherently challenging, requiring a deep grasp of compilation principles and\nunderlying architecture. **Compiler source code can be notoriously dense and difficult to understand, often intimidating\neven experienced developers.**\n\n**MacroSolver offers a more understandable and approachable way to learn. Instead of struggling with the complexity of\ncompiler code,** It demonstrates the core principles of macro expansion through concise code and clear logic. By\nreading, debugging, and modifying MacroSolver's code, you can gain a more intuitive understanding of the macro expansion\nprocess without the need to delve into vast and complex compiler source code\n\n## 项目结构 / Project Structure\n\n```\n├── CMakeLists.txt\n├── Doxygen.config\n├── LICENSE\n├── README.md\n├── define_list1.txt - define_list9.txt  // Macro definition files for testing\n├── macro_solver_test.cpp                // Test program\n└── my_std\n    └── normal\n        ├── CMakeLists.txt\n        ├── include\n        │   └── solve_macro.h            // Header file\n        └── src\n            └── solve_macro.cpp          // Implementation file\n```\n\n##              ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhish%2Fmacrosolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flhish%2Fmacrosolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhish%2Fmacrosolver/lists"}