GhostScript comes as three avatars. One is a command-line interpreter, the other reads files, and the third is without display but useful for debugging.

PostScript is a stack-based programming language. All commands take place on the operation stack. The commands use Reverse Polish Notation (RPN) - first arguments, then operation. This is like some HP calculators and the ancient programming language FORTH. You'll get used to working backwards, or if not you can program in front of a mirror.

A viewer such as gv has additional conveniences - it take into account various special types of comments that give a program structure, and when interpreting a file will re-read the file when it is changed.

At the opposite extreme is GhostScript without graphics display - gsnd. This is very useful for debugging. I am sorry to tell you that debugging PostScript with any of these programs is neither elegant nor simple.