If you want get programme with it, you need to allow one macro to call another.
Your repeat command, would simply become call macro X multiple times.
You create your limitation by on honouring only N levels of nesting.