Interpolation
Inside quote(...), use $(expr) to insert an expression into the generated code. This is how macros splice captured code fragments or computed values into the output.
The interpolation expression type must support conversion to Tokens (i.e., implement the ToTokens interface). In the standard library, Token, Tokens, all syntax node types, basic data types (integers, floating-point numbers, Bool, Rune, String), and Array<T> and ArrayList<T> all support interpolation.
The example on the right demonstrates the dprint debug macro: $(inputStr) inserts the string value (yielding "x + y"), while $(input) inserts the original Tokens (yielding x + y code). This allows printing both the expression itself and its value.
Rename inputStr to exprText and verify the macro still works correctly.
input.toString() returns the string representation of the code fragment, suitable for debug output. While $(input) directly inserts the code itself, which will be compiled and executed.define.cj and the commented usage example as main.cj. Run cjc define.cj --compile-macro, then cjc main.cj --import-path . -o main && ./main. The online single-file runner does not support this multi-file build step.