Macmac

Macmac is an esoteric programming language created by David Catt (user:David.werecat) in which every command is a function and loops are emulated using macros.

Instructions
To store values, there are two stacks and one storage register. All values are integer. Each line is executed sequentially. Each line must either be blank, null (an alias for 0), or a function. The parameters of a function may be null, an integer or another function. Functions are written using the syntax:. Using a function as a parameter will pass its return code as the parameter. Macros are defined as:. Macros can be defined anywhere in the code, even in function parameters (in which case null is passed as the parameter). Macros can only be executed if they are defined beforehand by using:. A macro usage can be put inside another macro even if that macro is not defined yet. Loops are achieved using macros that contain themselves. To comment a line, put  at the front of the line. All spaces and tabs are not interpreted. Usable functions are as follows:

Cat Program
{exec(put(get),[cat])} [cat]

Hello, World!
put(72) put(101) put(108) put(108) put(111) put(44) put(32) put(119) put(111) put(114) put(108) put(100) put(33)

Fibonacci Numbers
Prints the first few Fibonacci numbers. {exec([write],store(pop1),push2(add(recall,pop1)),push1(recall),push1(pop2),ifless(peek1,1000,[fib]))} {exec(push2(0),push2(0),push2(0),store(peek1),[hundreds],[tens],[ones],push1(0),ifmore(peek2,0,exec(put(add(peek2,48)),pop1,push1(1))),pop2,ifmore(peek2,0,put(add(peek2,48)),ifsame(recall,1,put(add(peek2,48)))),pop2,put(add(pop2,48)),pop1,put(10))} {ifmore(recall,99,exec(store(sub(recall,100)),push2(add(pop2,1)),[hundreds]))} {ifmore(recall,9,exec(store(sub(recall,10)),push1(pop2),push2(add(pop2,1)),push2(pop1),[tens]))} {ifmore(recall,0,exec(store(sub(recall,1)),push1(pop2),push1(pop2),push2(add(pop2,1)),push2(pop1),push2(pop1),[ones]))} push1(0) push1(1) [fib]

Conditional Macros
This shows how macros can be defined anywhere in the code (except inside other macros), and how that can be used to create macros with variable values. {ifsame(0,0, {put(33)}, {null})} [con] [mac]

External resources

 * Visual Basic .NET interpreter and sample programs