Attached are the two files related to parsing PostScript as part of processing PDF files.
One is the scanner (.pl) the other are the test cases (.plt).
Note: These have not been fully tested and are dumps of my code with lots of old code commented out but left in place. If you download them do not expect me to answer any questions on them as it was a few years ago when I created them and as I noted here, never finished the project because there was a better way to solve the problem I needed solving. They do have a copyright and are NOT released as Open Source, they are presented here to show how hard it is to create a PostScript scanner.
PostScript__scanner.pl (368.6 KB)
PostScript__scanner.plt (1.3 MB)