Even more simple.

Just add different label for subroutines, say, subroutines should start with SUB statement, after the label. At compile time, do check and that's all.