Do Terminal processes stop if Mac sleeps?
All processes get paused when the system goes to sleep, independent of whether the process is part of macOS, an application or some code you wrote on your own. After the system wakes up again, all processes will continue to run. 

PS: Processes which were waiting for network or disk data when going to sleep may run into timeouts though. But that can happen anyway so most processes should be able to handle that anyway.