For compiler directives, the strongest matches are babel/babel (Babel is a comprehensive compiler infrastructure that provides robust), facebook/jscodeshift (This toolkit provides the necessary AST manipulation and source-to-source) and sweet-js/sweet-core (Sweet-core is a source-to-source compiler and macro system that). golang/tools and rust-lang/rust-analyzer round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Explore the best open-source compiler directive libraries. We ranked top projects by activity and features to help you compare and pick the right one.
Babel is a pluggable JavaScript compiler and transpiler that converts modern ECMAScript syntax into backwards-compatible versions of the language. It functions as an abstract syntax tree manipulator, parsing source code into a hierarchical structure to traverse and modify nodes for custom code transformations. The system utilizes a plugin-driven architecture to apply specific transformation rules and supports presets that bundle multiple plugins into named configuration groups. This enables the transformation of experimental syntax and the injection of non-global polyfills to ensure consisten
Babel is a comprehensive compiler infrastructure that provides robust AST manipulation, source-to-source transformation, and a plugin architecture for custom annotation processing, making it a flagship tool for source-code processing.
jscodeshift is a JavaScript AST transformation toolkit and codemod engine designed for large-scale code refactoring and structural migrations. It provides a set of utilities to parse source code into abstract syntax trees, programmatically modify those trees, and convert them back into source text. The tool distinguishes itself by preserving original source formatting and stylistic properties during the transformation process. It utilizes a builder for generating structurally valid AST nodes and integrates interchangeable parsing engines to support different language standards and experimenta
This toolkit provides the necessary AST manipulation and source-to-source transformation capabilities required to process and refactor code based on structural annotations or directives.
Sweet-core is a JavaScript source-to-source compiler and Lisp-style macro system. It functions as a syntax transformer that extends JavaScript by allowing the definition of custom syntax and operators during the compilation process. The system provides a framework for building domain-specific languages through hygienic, recursive macro expansion and the creation of new language constructs. It distinguishes itself by supporting custom operator definitions with configurable associativity and precedence to control expression evaluation. The compiler includes a specialized module system for mana
Sweet-core is a source-to-source compiler and macro system that enables custom syntax extensions and AST transformations, directly addressing the need for advanced source-code processing and macro expansion.
This project is a collection of official toolsets and server implementations designed for the parsing, formatting, and semantic analysis of the Go programming language. It includes a language server that provides real-time code intelligence and automated editing capabilities to editors via the Language Server Protocol. The toolset provides a suite of utilities for source code formatting and static analysis. This includes automated standardization of code layout, import organization, and the generation of string representation methods for enumerated types. The project covers broad static anal
This repository provides a comprehensive suite of tools for Go source-code processing, including AST manipulation, static analysis, and a robust Language Server Protocol implementation, making it a primary resource for building custom code-processing utilities.
Rust-analyzer is a language server implementation that provides real-time code intelligence, static analysis, and development productivity tools for the Rust programming language. It functions as a backend engine that communicates with text editors to deliver deep structural understanding of source code, enabling features like semantic analysis, symbol navigation, and automated refactoring. The project distinguishes itself through a core engine designed for high-performance responsiveness, utilizing incremental query-based compilation and lazy demand-driven evaluation to minimize resource con
This is a language server and analysis engine that provides deep structural understanding of source code, including syntax inspection and macro expansion capabilities, making it a powerful tool for processing and analyzing source code.
This project is a high-performance static type checker and comprehensive development toolkit for Python. It functions as a core analysis engine that identifies type inconsistencies and enforces code correctness, while simultaneously providing a language server implementation to deliver real-time diagnostics and intelligence directly within development environments. The tool distinguishes itself through a parallelized execution engine that maximizes performance across large-scale codebases and monorepo structures. It supports gradual type adoption, allowing developers to integrate type checkin
This project provides a robust static analysis engine and language server that utilizes AST-based processing to perform deep code intelligence and diagnostic tasks, fitting the category of source-code processing tools.
The .NET Compiler Platform is a collection of open-source APIs for C# and Visual Basic that provides deep code analysis, refactoring, and automated source code generation. It serves as the core infrastructure for building development tools, offering a platform to inspect, modify, and understand source code through immutable syntax trees and semantic models. The platform distinguishes itself by providing full-fidelity syntax trees that preserve every character of source code, including whitespace and comments, alongside an incremental compilation pipeline that enables near-instant feedback dur
This is the official .NET compiler platform, providing the full suite of APIs required for AST manipulation, semantic analysis, and source code generation, making it the definitive tool for processing C# and Visual Basic code.
Zig is a general-purpose systems programming language designed for high-performance applications that require manual memory management and direct control over hardware resources. It prioritizes predictable execution by enforcing explicit control flow and requiring functions to accept explicit memory allocators, ensuring that all heap operations and logic paths remain visible to the developer. The language distinguishes itself through a powerful compile-time metaprogramming engine that allows for arbitrary code execution during the build process, enabling advanced reflection and the generation
Zig provides a powerful compile-time metaprogramming engine that enables arbitrary code execution, macro-like expansion, and direct manipulation of the compilation process, making it a robust tool for source-code processing and custom annotation-like logic.
RuboCop is a static code analyzer, linter, and formatter for the Ruby language. It detects style violations, potential bugs, and code smells by scanning source code without executing the program. The tool enforces a predefined Ruby style guide by flagging deviations and automatically rewriting source code to ensure consistency across projects. It includes a language server that provides real-time analysis and formatting suggestions directly within text editors.
RuboCop provides robust AST analysis, source-to-source code rewriting, and language server support, making it a highly capable tool for processing and enforcing rules on Ruby source code.
UglifyJS2 is a suite of tools designed for parsing, beautifying, mangling, and minifying JavaScript code. It functions by converting source code into an abstract syntax tree to enable programmatic analysis and transformation, and it includes a dedicated generator for creating associated source maps. The project optimizes web production builds by compressing script logic and removing unreachable code. It utilizes name mangling to shorten variable and property names and implements a beautifier to reconstruct compressed scripts into a human-readable layout. The toolset covers broad capability a
This tool provides a robust suite for parsing JavaScript into an abstract syntax tree and performing complex code transformations, which directly supports the implementation of source-code processing and custom code manipulation.
PostCSS is a CSS post-processor and abstract syntax tree transformation tool that parses stylesheets into a structured tree for programmatic analysis and modification. It functions as a plugin-driven pipeline where JavaScript plugins can modify, insert, or delete nodes to transform styles. The project provides a framework for building a custom plugin ecosystem to extend the CSS language with non-standard features such as loops, conditionals, and shorthand properties. It supports multi-syntax parsing through pluggable parsers and stringifiers, allowing it to process various style formats and c
PostCSS is a robust framework for parsing CSS into an abstract syntax tree and executing custom transformations, which directly addresses the need for source-code processing and annotation-like extensions within the CSS domain.
The project is a modular compiler infrastructure framework designed for building programming language toolchains, frontends, and backends. It provides a comprehensive suite of reusable libraries and tools that enable developers to transform source code into efficient native executables across diverse hardware architectures and operating systems. At its core, the system utilizes a language-agnostic intermediate representation bitcode, which serves as a unified format for code analysis, optimization, and machine-specific code generation. What distinguishes this framework is its highly decoupled
This project provides the industry-standard infrastructure for building compilers, offering robust support for AST manipulation, source-to-source transformations, and custom annotation processing through its modular library architecture.
esbuild is a high-performance JavaScript bundler and transpiler designed to transform modern web assets into production-ready code. Built with a focus on speed, it utilizes a concurrent execution model to perform parsing, linking, and code generation across multiple CPU cores. The engine handles a wide range of tasks, including TypeScript compilation, JSX transformation, and CSS bundling, while maintaining a consistent build process across diverse environments. What distinguishes the project is its architecture, which leverages memory-mapped file processing and a single-pass transformation st
This is a high-performance compiler and transpiler that performs AST-based transformations and supports custom plugin-based code processing, making it a robust tool for source-code manipulation tasks.
Nim is a statically typed, compiled systems programming language designed for high performance and cross-platform development. It translates high-level source code into C, C++, or JavaScript, allowing developers to produce efficient native binaries or web-compatible scripts from a single codebase. The language emphasizes a clean, indentation-based syntax that simplifies code hierarchy while maintaining the power of a full-featured systems language. What distinguishes Nim is its robust metaprogramming framework, which allows developers to inspect, modify, and generate code structures during th
Nim is a systems programming language with a powerful metaprogramming framework that enables AST manipulation, macro expansion, and custom compile-time code generation, making it a robust tool for source-code processing.
Pyrefly is a static type checker for Python that operates as a language server, delivering real-time diagnostics, completions, and navigation in any editor supporting the Language Server Protocol. It also performs static tensor shape analysis, using symbolic dimension variables and arithmetic to verify shape consistency in deep learning models without runtime execution. Beyond core type checking, Pyrefly supports gradual adoption workflows: it can generate a baseline of known errors so only new issues are reported, migrate configuration from other type checkers, and automatically suppress exi
Pyrefly is a static analysis and language server tool for Python that performs deep code inspection and type validation, fitting the category of source-code processing infrastructure even though it focuses on type checking rather than general-purpose macro expansion.
TypeScript is a language that extends standard syntax by adding a static type system. It identifies potential runtime errors by analyzing the behaviors and capabilities of values during the compilation process. The language supports object-oriented structures, including classes with inheritance and member visibility control, as well as flexible function definitions that utilize generics, overloads, and parameter destructuring. The project provides a compiler that manages the build lifecycle through a command-line interface, offering configurable options for module resolution, code generation,
TypeScript provides a robust compiler infrastructure that includes a full AST parser, source-to-source transformation capabilities, and extensive support for language server protocols, making it a powerful tool for source-code processing and custom analysis.
This project is a multi-language compiler collection and cross-platform toolchain used to translate source code from various programming languages into optimized machine code for different hardware architectures. It provides a suite of tools including an optimizing compiler backend, a machine code generator, and a comprehensive runtime library suite that implements necessary execution environments and support functions. The system utilizes a multi-pass compilation pipeline and pluggable language front-ends to process source code into intermediate representations. It distinguishes itself throu
GCC is a comprehensive compiler infrastructure that provides the foundational AST representation and multi-pass processing pipeline required for source-code analysis and transformation, though it is primarily designed for machine-code generation rather than source-to-source tasks.
Racket is a general-purpose, multi-paradigm programming language in the Lisp family designed for language creation. It functions as a language workbench, providing a platform for designing and implementing custom programming languages through a flexible system of macros and modules. The system distinguishes itself by offering a comprehensive suite for semantics engineering, allowing for the construction of specialized language subsets and educational layers. It includes tools for custom language design, such as lexer and parser generation, as well as the ability to define module expansion rul
Racket is a powerful language workbench specifically designed for creating custom languages and implementing complex macro systems, making it an ideal platform for building sophisticated source-code processing tools and custom annotation handlers.
Janino is a lightweight Java compiler and scripting engine designed to transform source code into executable bytecode directly within the application heap. It functions as a runtime compiler and class loading library, enabling the dynamic definition and execution of Java classes, methods, and expressions without requiring a full application restart. The project distinguishes itself through its ability to perform in-memory compilation and recursive descent parsing, which allows for the resolution of complex dependencies and circular references during the translation process. It provides a fram
Janino is a lightweight Java compiler that supports runtime compilation and source-code processing, making it a suitable tool for handling dynamic code generation and custom compilation tasks.
Closure Compiler is a JavaScript build utility designed to transform, optimize, and validate source code for production environments. It functions as a minifier and transpiler, converting modern ECMAScript syntax into older, widely compatible versions to ensure reliable execution across diverse browsers. The tool distinguishes itself through a multi-pass optimization pipeline that performs complex refactoring, such as constant folding, function inlining, and variable renaming. It utilizes a static type inference engine to detect potential runtime errors and enforce type safety without requiri
This tool provides a JavaScript-based implementation of the Closure Compiler, enabling source-code optimization and transformation through a standard compiler pipeline.
MoonBit is a programming language compiler and build system designed to translate source code into high-performance binaries for web, browser, and native environments. It provides a unified toolchain that manages the entire development lifecycle, from source code compilation and dependency management to the final bundling of applications. The platform distinguishes itself through a modular architecture that enables cross-environment logic sharing, allowing developers to maintain a single codebase that targets both WebAssembly and native machine code. By utilizing a strongly-typed intermediate
MoonBit is a full-stack compiler infrastructure that provides a complete toolchain for source-to-source compilation, AST manipulation, and custom language processing, making it a robust choice for handling complex source-code transformations.
This project is a JavaScript optimizer, minifier, module bundler, transpiler, and static analysis tool. It provides a compilation pipeline designed to shrink file sizes and improve runtime performance. The system utilizes a multi-pass compilation process to perform dead code elimination, global name mangling, and static type inference. It identifies unreachable functions and unused variables to reduce the final output size and detects potential runtime errors without executing the code. The tool manages assets through dependency resolution, code chunking, and bundle management. It ensures co
This tool functions as a sophisticated JavaScript compiler that performs static analysis, source-to-source transformation, and code optimization, aligning well with the requirements for source-code processing and compiler infrastructure.
Detekt is a static analysis tool, code quality linter, and complexity analyzer for Kotlin source code. It functions as a code smell detector and static scanner designed to identify potential bugs, design flaws, and violations of coding standards without executing the program. The tool differentiates itself through the use of issue baselining, which allows users to create a snapshot of existing legacy code issues to filter out old violations and focus on preventing new regressions. It further supports extensibility via a plugin-based system that allows for the integration of custom rule sets a
Detekt is a static analysis tool that provides deep access to Kotlin's abstract syntax tree and supports custom rule development, making it a capable framework for processing source-code annotations and enforcing custom coding standards.
mypy is a static type checker for Python that analyzes source code to detect type errors and inconsistencies without executing the program. It functions as a static analysis tool and type inference engine, providing a gradual typing system that allows type hints to be added to a codebase incrementally while maintaining compatibility with dynamic typing. The project distinguishes itself through a combination of performance and precision features. It utilizes a daemon-based incremental checking system and multi-process parallel analysis to manage large codebases, supported by binary cache persi
Mypy is a static analysis tool that processes Python source code and type annotations to perform type checking, fitting the category of source-code processing tools even though its primary focus is validation rather than general-purpose source-to-source transformation.
Grin is a compiler infrastructure designed for the translation and optimization of high-level functional languages. It functions as a graph-reduction compiler, transforming source code into a standardized intermediate representation that facilitates whole-program analysis and efficient execution across diverse hardware architectures. The project distinguishes itself through a modular backend infrastructure that separates intermediate representation management from target-specific code generation. By utilizing graph-based transformations, the system performs advanced optimizations such as valu
Grin is a compiler infrastructure that provides a standardized intermediate representation and modular backend for source-code transformation and optimization, fitting the category of compiler infrastructure even though it focuses on graph-reduction rather than general-purpose annotation processing.
Compile Testing
This library provides a framework for testing Java annotation processors and compiler plugins, making it a specialized tool for verifying source-code processing logic rather than a general-purpose compiler infrastructure.
This project is a functional programming compiler and JavaScript transpiler that transforms a statically typed language into optimized JavaScript for web browsers. It serves as a frontend architecture framework, providing a static type system and a package manager that enforces semantic versioning. The compiler uses a type-checking engine with automatic type inference to prevent runtime errors and guide code refactoring. It implements a structural pattern for managing application state and rendering user interfaces through a virtual DOM, utilizing immutable data and purity-based state transit
This is a complete compiler for the Elm language that performs source-to-source transformation into JavaScript, though it is designed as a closed-system tool rather than a general-purpose library for arbitrary annotation processing or AST manipulation.
F# to JavaScript, TypeScript, Python, Rust, Erlang and Dart Compiler
Fable is a source-to-source compiler that transforms F# code into multiple target languages, providing the core capability of code processing and transformation required for this category.
| Repository | Stars | Sprache | Lizenz | Letzter Push |
|---|---|---|---|---|
| babel/babel | 44K | TypeScript | MIT | |
| facebook/jscodeshift | 10K | JavaScript | mit | |
| sweet-js/sweet-core | 4.6K | JavaScript | BSD-2-Clause | |
| golang/tools | 8K | Go | BSD-3-Clause | |
| rust-lang/rust-analyzer | 16.6K | Rust | Apache-2.0 | |
| astral-sh/ty | 17.3K | Python | mit | |
| dotnet/roslyn | 20.2K | C# | mit | |
| ziglang/zig | 43.1K | Zig | MIT | |
| rubocop-hq/rubocop | 12.9K | Ruby | MIT | |
| mishoo/uglifyjs2 | 13.4K | JavaScript | NOASSERTION |