What you want can be done with emacs scripting.
I wrote this script for you which does exactly what you want and can be easily extended to any language.
Filename: kill-comments
#!/usr/bin/python                                                         
import subprocess                                                         
import sys                                                                
import os                                                                 
target_file = sys.argv[1]                                                 
command =   "emacs -batch -l ~/.emacs-batch " + \                         
    target_file + \                                                       
    " --eval '(kill-comment (count-lines (point-min) (point-max)))'" + \  
    " -f save-buffer"                                                     
#to load a custom .emacs script (for more syntax support),                
#use -l <file> in the above command                                       
#print command                                                            
fnull = open(os.devnull, 'w')                                             
subprocess.call(command, shell = True, stdout = fnull, stderr = fnull)    
fnull.close()
to use it just call:
kill-comments <file-name>
To add any language to it edit ~/.emacs-batch and add that language's major mode.
You can find syntax aware modes for basically everything you could want at http://www.emacswiki.org.
As an example, here is my ~/.emacs-batch file.  It extends the above script to remove comments from javascript files. (I have javascript.el in my ~/.el directory)
(setq load-path (append (list (concat (getenv "HOME") "/.el")) load-path))    
(load "javascript")                                               
(setq auto-mode-alist (cons '("\\.js$" . javascript-mode) auto-mode-alist))
With the javascript addition this will remove comments from all the filetypes you mentioned as well as many more.
Good Luck and happy coding!