5 个仓库
Replacing matched AST nodes with new code using a string-like syntax that ignores formatting differences.
Distinct from Code Transformation Tools: Distinct from Code Transformation Tools: focuses on pattern-based replacement with formatting-agnostic syntax rather than general AST manipulation.
Explore 5 awesome GitHub repositories matching software engineering & architecture · Pattern-Based Replacements. Refine with filters or upvote what's useful.
GoGoCode is an AST-based code transformation toolkit that enables developers to query, match, and rewrite JavaScript source code using jQuery-style selectors and wildcard patterns. At its core, it provides a programmatic code refactoring library that manipulates parsed AST nodes, allowing precise structural modifications without worrying about formatting differences. The toolkit also functions as a JavaScript AST query engine, finding code patterns through snippet-based matching with wildcards that capture unknown or variable-length fragments. What distinguishes GoGoCode is its callback-drive
Replaces matched AST nodes with new code using a string-like syntax that ignores formatting differences.
Shellharden 是一个 Shell 脚本加固工具和 linter,旨在提高 Bash 脚本的安全性和可靠性。它作为一个自动化工具,重写脚本以遵循行业标准的引用和安全实践。 该项目提供了一个优化器和标准化工具,用更安全的函数等效项替换不安全的模式和别名。它包含一个语法高亮器,使用视觉标记和颜色来指示漏洞以及需要进行引用修正的区域。 该工具涵盖了广泛的功能,包括自动安全修复、漏洞检测和脚本错误检测。这些功能通过自动重写和结构化语法验证确保脚本的一致性。
Replaces unsafe shell scripting patterns with industry-standard equivalents using automated text rewriting.
c2rust is a source-to-source translation suite and C-to-Rust transpiler designed to convert C source code and libraries into functionally equivalent unsafe Rust code. It operates as a pipeline that preserves original behavior and data structures, producing translated code that compiles as compatible shared libraries or Rust crates. The system includes an automated Rust refactoring framework that uses pattern-based AST rewriting to transform unsafe Rust into safe, idiomatic constructs. It utilizes an ownership inference engine to determine when raw pointers can be converted into safe reference
Replaces matched statements or expressions with new syntax produced by a callback or a pattern template.
onnxsim 是一个深度学习图优化器和模型简化器,旨在降低 ONNX 计算图的复杂度。它充当模型压缩器,用简化的常量输出替换复杂的算子序列,以减少操作开销。 该项目通过常量折叠推理实现简化,将常量算子的子图替换为预计算的常量张量。它利用基于模式的图重写和静态计算图分析来识别并删除冗余节点或不可达操作。 该工具涵盖了广泛的模型优化功能,包括算子冗余消除以及删除不必要的 reshape 或 identity 节点。这些过程简化了执行流程并减少了模型的内存占用。
Uses pattern-based rewriting to replace operator sequences with simplified equivalent structures.
OpenRewrite is an automated refactoring engine and source-to-source migration framework. It uses a lossless semantic tree parser to represent source code as type-aware trees that preserve original whitespace and formatting, enabling precise and deterministic modifications. The project utilizes a declarative refactoring pipeline where sequences of transformations are defined in YAML to resolve breaking changes and technical debt. It features type-aware pattern matching and cross-language model mapping to apply similar refactoring patterns across different programming languages. The framework
Swaps expressions or statements using type-aware templates that leverage compiler information for accurate replacement.