My research advisor has instead suggested that I implement some sort of Abstract Syntax Tree (AST) manipulation system, which would allow naming AST segments and splicing them. I'd rather have my template system be usable in the macro system or vice versa, instead of having two completely independent systems with similar purposes. When a macro name is found in the source, the parser calls the associated generator function with the AST segments corresponding to the function call arguments.