What problem does it solve?
This Skill helps developers learn and implement the Cangjie macro language for compile-time code transformation, covering tokens, quote expressions, and macro communication, and it explains how to leverage std.ast for parsing and AST manipulation.
Core Features & Use Cases
- Understand token and Tokens types, and how to manipulate with quote and interpolation.
- Learn macro definitions for non-attribute and attribute macros, their invocation syntax, and cross-macro communication patterns.
- Explore nested macros, context passing using setItem/getChildMessages, and diagnostic support during macro expansion.
- Utilize std.ast to parse, traverse, and transform ASTs for code generation and boilerplate automation.
- Real-world use: auto-generate boilerplate such as toString, logging, or performance instrumentation at compile time.
Quick Start
Create a small macro package and apply an attribute macro to a class to auto-generate a toString method.