8 个仓库
Rewriting or generating code at compile time using macros to implement custom language features or reduce boilerplate.
Distinct from Compile-Time Code Generation: Distinct from Compile-Time Code Generation: focuses on macro-based AST transformations rather than general code generation techniques.
Explore 8 awesome GitHub repositories matching software engineering & architecture · Macro-Driven Transformations. Refine with filters or upvote what's useful.
Haxe is a statically typed, multi-target programming language and open-source compiler toolkit that translates a single codebase into native executables and scripts for JavaScript, C++, C#, Java, Python, Lua, PHP, and Flash targets. It provides a unified type system with automatic type inference, a compile-time macro system for code transformation and generation, conditional compilation directives, and a static analysis engine that enforces null safety and eliminates dead code to produce smaller, safer outputs. The language is supported by the HashLink virtual machine, which executes platform
Provides a compile-time macro system for rewriting and generating code during compilation.
thiserror is a Rust error handling library and procedural macro designed to define custom error types. It functions as a trait implementation automator that generates the necessary code for standard library error traits at compile time. The library focuses on eliminating boilerplate by using derive macros to automatically implement display and source methods. It allows for the creation of custom error structs and enums that can map low-level errors to high-level variants while preserving the original cause and backtrace information. Its capabilities cover custom error formatting through temp
Uses Rust procedural macros to generate the standard Display and Error trait implementations at compile time.
Racket 是一种通用的、多范式编程语言,属于 Lisp 家族,专为语言创建而设计。它作为一个语言工作台,通过灵活的宏和模块系统,为设计和实现自定义编程语言提供了一个平台。 该系统的特色在于提供了一套全面的语义工程套件,允许构建专门的语言子集和教育层。它包括用于自定义语言设计的工具,如词法分析器和解析器生成,以及在读取时定义模块扩展规则和动态语言选择的能力。 该项目提供了一个集成开发环境,内置编辑器、可视化调试器和软件包管理器。其功能范围扩展到涵盖 2D 图形渲染、二进制数据处理、SQL 和演绎数据库集成以及图形用户界面构建的通用标准库。 该环境支持将源代码编译为独立的二进制可执行文件以进行分发。
Transforms source code into structured parse trees using a domain-specific language for semantics engineering.
Sweet-core 是一个 JavaScript 源码到源码(source-to-source)的编译器和 Lisp 风格的宏系统。它作为一个语法转换器,通过允许在编译过程中定义自定义语法和运算符来扩展 JavaScript。 该系统提供了一个框架,用于通过卫生的(hygienic)、递归的宏展开和创建新的语言结构来构建领域特定语言(DSL)。它的独特之处在于支持具有可配置结合性和优先级的自定义运算符定义,以控制表达式的求值。 该编译器包含一个专门的模块系统,用于管理编译时依赖项和运行时辅助工具的集成。其内部架构涵盖了抽象语法树(AST)转换、语法生成匹配和语法对象生成,以确保词法卫生。 提供了一个命令行接口,用于将源文件转换为标准的 JavaScript 输出文件或目录。
Supports advanced macro-driven transformations for implementing custom language features and recursive syntax transformers.
BeeHive 是一个 iOS 应用的模块化架构框架。它提供了一个依赖注入容器、事件总线中间件、模块生命周期管理器和服务定位器,将应用程序组织成独立的职能模块。 该框架的独特之处在于利用异步模块加载来减少应用启动时间并防止主线程阻塞。它采用宏驱动的自动模块注册来解耦实例化与应用逻辑,并使用基于协议的服务映射来解析依赖关系,而无需直接导入。 该项目涵盖了模块间通信和事件编排的高级能力,允许在隔离单元之间广播自定义业务触发器。它还包括用于全局应用状态分发以及协调模块生命周期中初始化和销毁序列的基础设施。
Uses compiler macros to automatically discover and register functional units during the build process.
该项目为 Clojure 开发提供了一套软件架构指南、Lisp 编码标准和函数式编程模式。它确立了通过使用持久数据结构和原子引用来实现声明式逻辑和管理共享状态的最佳实践。 该指南涵盖了记录公共 API 和组织项目目录的标准,以确保可移植的库分发。它详细说明了应用一致的格式化和命名规则,以提高源代码可读性和团队协作。 其范围扩展到惯用开发模式,包括命名空间的组织、函数定义和测试套件的结构,以及宏的负责任设计。它还提供了关于处理与外部类型的互操作以及通过稳定坐标管理库分发的指导。
Establishes best practices for designing complex macros by breaking them into small, testable functions.
CC 是一个 Android 组件化框架和模块化工具,旨在将单体应用转换为独立组件。它提供了一个用于隔离启动和调试单个组件以缩短编译时间的系统,以及一个用于使用统一接口跨不同 Android 进程执行函数的通信层。 该项目利用构建时字节码插件自动注册组件和拦截器,消除了手动配置样板代码的需要。它支持增量架构迁移,允许代码库逐步向组件化结构迈进,而无需完全重写。 该框架通过共享接口处理组件映射,并通过基于拦截的请求流水线路由调用。这些功能促进了解耦的模块管理和跨进程服务调用。
Uses a build-time bytecode plugin to automatically register components and interceptors without manual configuration.
unplugin-auto-import is a JavaScript auto-import plugin designed to eliminate the need for manual import statements in JavaScript and TypeScript projects. It identifies and registers modules to automatically inject necessary dependencies during the build process. The project utilizes a unified bundler plugin interface to provide consistent transformation logic across Vite, Webpack, and Rollup environments. It includes a TypeScript declaration generator to produce type definition files for auto-imported identifiers, ensuring IDE autocompletion and type checking. Additionally, it provides a sta
Automatically discovers and registers modules and APIs during the build process to eliminate manual imports.