Encapsulated PostScript is a text file format. I presume there's some documentation floating around about the format (try Adobe's web site). Once you've read up on that, it's just a matter of writing a text file with the appropriate Postscript commands.
But if you're after a vector file format, and you don't really care about exactly which format you use, you might also consider using SVG instead.