@@ -46,20 +46,21 @@ Compiler plugins can influence different stages of the compilation process.
4646
4747![ Kotlin compiler stages] ( compiler-stages.svg ) {width=300}
4848
49- The Kotlin compiler first parses the source code and turns it into a structured syntax tree. During analysis and resolution,
50- the compiler determines what the code means by resolving names, checking types, and enforcing visibility.
49+ The Kotlin compiler:
5150
52- After that, the compiler generates an Intermediate Representation (IR), which is a data structure the compiler uses as a
53- bridge between source code and machine code. This IR is progressively lowered into simpler forms and finally translated
54- into target-specific output, such as JVM bytecode, JavaScript, or native machine code.
51+ 1 . Parses the source code and turns it into a structured syntax tree.
52+ 2 . Analyzes and resolves the code by determining what it means, resolving names, checking types, and enforcing visibility rules.
53+ 3 . Generates an Intermediate Representation (IR), a data structure that acts as a bridge between source code and machine code.
54+ 4 . Progressively lowers the IR into simpler forms.
55+ 5 . Translates the lowered IR into target-specific output, such as JVM bytecode, JavaScript, or native machine code.
5556
5657![ Kotlin compiler stages] ( compiler-stages-with-plugins.svg ) {width=650}
5758
58- Plugins affect the initial compiler stages through the frontend API, changing how the compiler resolves code.
59+ Plugins can affect the initial compiler stages through the frontend API, changing how the compiler resolves code.
5960For example, a plugin can add annotations or introduce new methods without bodies, or change visibility modifiers. These
6061changes are visible in the IDE.
6162
62- Plugins affect the later stages through the backend API, modifying the behavior of declarations. These
63+ Plugins can also affect the later stages through the backend API, modifying the behavior of declarations. These
6364changes appear in the binaries produced after compilation completes.
6465
6566In practice, compiler plugins affect the stages from analysis and resolution through code generation,
0 commit comments