XXIIVV

Using inline functions in Uxntal.

A macro is a way of defining inline routines, it allows to create new words that will be replaced by the body of the macro, as opposed to a jump where the program counter will move to a routine and back, therefore it needs to be defined before its usage, as follow:

%modulo ( num denum -- res ) {
	DIVk MUL SUB
}

@routine ( -- c* )
	#18 #03 modulo
	JMP2r

In the previous example, the token modulo will get replaced by the body of the macro during assembly:

@routine ( -- c* )
	#18 #03 DIVk MUL SUB
	JMP2r

Note: A macro does not have a scope, so it may not contain sublabels if the macro is to be used multiple time within a single parent label, lambdas are immune to this limitation.

incoming forth uxntal syntax