# Pastebin sYQo4DvS import macros macro createStringConstNimNode(constName: string, constVal: string): typed = result = newNimNode(nnkConstDef) result.add(newIdentNode(constName)) result.add(newIdentNode("string")) result.add(newStrLitNode(constVal)) macro tester(): typed = result = newNimNode(nnkStmtList) let constSection = newNimNode(nnkConstSection) constSection.add(createStringConstNimNode("TestConst", "Hello, World!")) result.add(constSection) tester() echo TestConst