I think I never mentioned this before, but there is a simple trick that uses an unconditional label interceptor to detect whether something is a name of an existing instruction:
struc (present) instruction? name*
present = 1
calminstruction (label) ?! any&
compute present, 0
end calminstruction
if 0
name
end if
restruc ?
end struc
macro try name
is instruction name
display `name,' is ',string (is xor 1)*'NOT ','defined as instruction.',13,10
end macro
try dq
try dqq
try dqqq
Because the interceptor is unconditional, it is executed even inside the "if 0" block, but only when the initial symbol of the line is considered a label, which implies that it is not recognized as an existing instruction.
I'm posting this as I'm designing a new set of CALM-specific operations that may allow to perform checks of this kind in an "official" and reliable way. Still, I think it's an interesting trick that demonstrates how some of fasmg's cogs intertwine.